CVB++ 14.0
Client Class Reference

An OPCUA Client object. This class handles the client side of the OPCUA client/server interaction. More...

#include <cvb/opcua/client.hpp>

Inherits enable_shared_from_this< OpcUa::Client >.

Public Member Functions

void * Handle () const noexcept
 Returns C-API style handle to the client. More...
 
template<class T >
std::shared_ptr< T > Node (const OpcUa::NodeID &id) const
 Returns a node (typed). Valid types are BaseNode and all derivatives. More...
 
BaseNodePtr Node (const OpcUa::NodeID &id) const
 Returns a node (without type). More...
 
OpcUa::BaseNodePtr RootNode () const
 Returns the 'root' node of the server. This is a helper for traversing the entire server structure. More...
 
SubscriptionPtr Subscribe ()
 Creates an OPCUA Subscribtion for an OPCUA Client. You can add node as monitored items (and receive updates if variable data changes). More...
 

Static Public Member Functions

static OpcUa::ClientPtr Create (const Cvb::String &Url)
 Creates an OPCUA Client object. And connect it to a given server. There is no disconnect/connect function. The client is connect at creation and disconnected on deconstruction. More...
 

Detailed Description

An OPCUA Client object. This class handles the client side of the OPCUA client/server interaction.

Note
For details refer to the OPCUA specification Part 1:
https://opcfoundation.org/developer-tools/specifications-unified-architecture/part-1-overview-and-concepts/

Member Function Documentation

◆ Create()

OpcUa::ClientPtr Create ( const Cvb::String Url)
inlinestatic

Creates an OPCUA Client object. And connect it to a given server. There is no disconnect/connect function. The client is connect at creation and disconnected on deconstruction.

Returns
A shared_ptr to a Client Object
Exceptions
Anyexception derived from std::exception including CvbException and OpcUaException.
Examples
OpcUa/BareboneClient, and OpcUa/ServerClientInteraction.

◆ Handle()

void * Handle ( ) const
inlinenoexcept

Returns C-API style handle to the client.

Returns
C-API handle

◆ Node() [1/2]

std::shared_ptr< T > Node ( const OpcUa::NodeID id) const
inline

Returns a node (typed). Valid types are BaseNode and all derivatives.

Exceptions
Anyexception derived from std::exception including CvbException and OpcUaException.

◆ Node() [2/2]

BaseNodePtr Node ( const OpcUa::NodeID id) const
inline

Returns a node (without type).

Note
Please use this method only if you don't know the type of the node. Otherwise use Client::Node<Type>(...).
Parameters
[in]idOPCUA NodeID identifing the requested node.
Exceptions
Anyexception derived from std::exception including CvbException and OpcUaException.

◆ RootNode()

OpcUa::BaseNodePtr RootNode ( ) const

Returns the 'root' node of the server. This is a helper for traversing the entire server structure.

Exceptions
Anyexception derived from std::exception including CvbException and OpcUaException.

◆ Subscribe()

SubscriptionPtr Subscribe ( )
inline

Creates an OPCUA Subscribtion for an OPCUA Client. You can add node as monitored items (and receive updates if variable data changes).

Returns
SubscriptionPtr to the subscription.
Exceptions
Anyexception derived from std::exception including CvbException and OpcUaException.