C++ Based OPC UA Client/Server SDK  1.5.3.346
UaClientSdk::UaSession Class Reference

The UaSession class manges a UA Client side application session. More...

#include <uasession.h>

Inherits UaDataTypeDictionary, and UaClientSdk::CertificateValidationCallback.

Public Member Functions

 UaSession ()
 Creates a new UaSession client object.
 
 UaSession (UaSession *pSession)
 Creates a UaSession client object with a reference the connection from the other UaSession. More...
 
virtual ~UaSession ()
 Destroys the UaSession object.
 
UaStatus connect (const UaString &sURL, SessionConnectInfo &sessionConnectInfo, SessionSecurityInfo &sessionSecurityInfo, UaSessionCallback *pSessionCallback)
 Establish a connection to the OPC UA server. More...
 
UaStatus disconnect (ServiceSettings &serviceSettings, OpcUa_Boolean bDeleteSubscriptions)
 Disconnect client application from OPC UA server. More...
 
UaStatus changeUser (ServiceSettings &serviceSettings, UaUserIdentityToken *pUserIdentityToken)
 Change user for the connection to the OPC UA server. More...
 
UaStatus browse (ServiceSettings &serviceSettings, const UaNodeId &nodeToBrowse, const BrowseContext &browseContext, UaByteString &continuationPoint, UaReferenceDescriptions &referenceDescriptions)
 Browse OPC UA server Address Space with a single starting Node. More...
 
UaStatus browseNext (ServiceSettings &serviceSettings, OpcUa_Boolean releaseContinuationPoint, UaByteString &continuationPoint, UaReferenceDescriptions &referenceDescriptions)
 Continue a previous Browse request. More...
 
UaStatus browseList (ServiceSettings &serviceSettings, const OpcUa_ViewDescription &viewDescription, OpcUa_UInt32 maxReferencesToReturn, const UaBrowseDescriptions &browseDescription, UaBrowseResults &browseResults, UaDiagnosticInfos &diagnosticInfos)
 Browse OPC UA server Address Space with a list of starting Nodes. More...
 
UaStatus browseListNext (ServiceSettings &serviceSettings, OpcUa_Boolean releaseContinuationPoint, const UaByteStringArray &continuationPoints, UaBrowseResults &browseResults, UaDiagnosticInfos &diagnosticInfos)
 Continue a previous browseList request. More...
 
UaStatus translateBrowsePathsToNodeIds (ServiceSettings &serviceSettings, const UaBrowsePaths &browsePaths, UaBrowsePathResults &browsePathResults, UaDiagnosticInfos &diagnosticInfos)
 Translate a browse path to a NodeId. More...
 
UaStatus registerNodes (ServiceSettings &serviceSettings, const UaNodeIdArray &nodesToRegister, UaNodeIdArray &registeredNodesIds)
 Register nodes to create shortcuts in the server. More...
 
UaStatus unregisterNodes (ServiceSettings &serviceSettings, const UaNodeIdArray &registeredNodesIds)
 Unregister nodes to delete shortcuts in the server. More...
 
UaStatus read (ServiceSettings &serviceSettings, OpcUa_Double maxAge, OpcUa_TimestampsToReturn timeStamps, const UaReadValueIds &nodesToRead, UaDataValues &values, UaDiagnosticInfos &diagnosticInfos)
 Reads Attribute values synchronously from an OPC UA server. More...
 
UaStatus beginRead (ServiceSettings &serviceSettings, OpcUa_Double maxAge, OpcUa_TimestampsToReturn timeStamps, const UaReadValueIds &nodesToRead, OpcUa_UInt32 transactionId)
 Reads attribute values asynchronously from an OPC UA server. More...
 
UaStatus write (ServiceSettings &serviceSettings, const UaWriteValues &nodesToWrite, UaStatusCodeArray &results, UaDiagnosticInfos &diagnosticInfos)
 Writes variable values synchronously to an OPC UA server. More...
 
UaStatus beginWrite (ServiceSettings &serviceSettings, const UaWriteValues &nodesToWrite, OpcUa_UInt32 transactionId)
 Writes variable values asynchronously to an OPC UA server. More...
 
UaStatus createSubscription (ServiceSettings &serviceSettings, UaSubscriptionCallback *pUaSubscriptionCallback, OpcUa_UInt32 clientSubscriptionHandle, SubscriptionSettings &subscriptionSettings, OpcUa_Boolean publishingEnabled, UaSubscription **ppUaSubscription)
 Creates a subscription. More...
 
UaStatus deleteSubscription (ServiceSettings &serviceSettings, UaSubscription **ppUaSubscription, OpcUa_UInt32 waitTimeForTransactionCompletion=100)
 Deletes a subscription. More...
 
UaStatus transferSubscription (ServiceSettings &serviceSettings, UaSubscriptionCallback *pUaSubscriptionCallback, OpcUa_UInt32 clientSubscriptionHandle, OpcUa_UInt32 subscriptionId, SubscriptionSettings &subscriptionSettings, OpcUa_Boolean publishingEnabled, OpcUa_Boolean sendInitialValues, UaSubscription **ppUaSubscription, UaUInt32Array &availableSequenceNumbers)
 Transfers a subscription from another client to this session. More...
 
UaStatus call (ServiceSettings &serviceSettings, const CallIn &callRequest, CallOut &results)
 Calls a method of an Object on the OPC UA server. More...
 
UaStatus beginCall (ServiceSettings &serviceSettings, const CallIn &callRequest, OpcUa_UInt32 transactionId)
 Calls a method of an Object on the OPC UA server. More...
 
UaStatus callList (ServiceSettings &serviceSettings, const UaCallMethodRequests &callMethodRequests, UaCallMethodResults &callMethodResults, UaDiagnosticInfos &diagnosticInfos)
 Calls a list of methods of Objects on the OPC UA server. More...
 
UaStatus historyReadRawModified (ServiceSettings &serviceSettings, const HistoryReadRawModifiedContext &historyReadRawModifiedContext, const UaHistoryReadValueIds &nodesToRead, HistoryReadDataResults &results, UaDiagnosticInfos &diagnosticInfos)
 Reads the history of variable values synchronously from an OPC UA server. More...
 
UaStatus historyReadProcessed (ServiceSettings &serviceSettings, const HistoryReadProcessedContext &historyReadProcessedContext, const UaHistoryReadValueIds &nodesToRead, HistoryReadDataResults &results, UaDiagnosticInfos &diagnosticInfos)
 Reads the processed history of variable values synchronously from the OPC UA server based on a passed aggregate. More...
 
UaStatus historyReadAtTime (ServiceSettings &serviceSettings, const HistoryReadAtTimeContext &historyReadAtTimeContext, const UaHistoryReadValueIds &nodesToRead, HistoryReadDataResults &results, UaDiagnosticInfos &diagnosticInfos)
 Reads the history of item values synchronously from an OPC UA server for the given timestamps. More...
 
UaStatus historyReadEvent (ServiceSettings &serviceSettings, const HistoryReadEventContext &historyReadEventContext, const UaHistoryReadValueIds &nodesToRead, HistoryReadEventResults &results, UaDiagnosticInfos &diagnosticInfos)
 Reads the event history for a list of event notifier objects synchronously from an OPC UA server. More...
 
UaStatus historyUpdateData (ServiceSettings &serviceSettings, const UpdateDataDetails &updateDataDetails, UaHistoryUpdateResults &results, UaDiagnosticInfos &diagnosticInfos)
 Updates the history of variable values synchronously on an OPC UA server. More...
 
UaStatus historyDeleteRawModified (ServiceSettings &serviceSettings, const DeleteRawModifiedDetails &deleteDetails, UaHistoryUpdateResults &results, UaDiagnosticInfos &diagnosticInfos)
 Deletes the history of item values synchronously on an OPC UA server. More...
 
UaStatus historyDeleteAtTime (ServiceSettings &serviceSettings, const DeleteAtTimeDetails &deleteDetails, UaHistoryUpdateResults &results, UaDiagnosticInfos &diagnosticInfos)
 Deletes the history of item values synchronously on an OPC UA server for the given timestamps. More...
 
UaStatus historyUpdateEvents (ServiceSettings &serviceSettings, const UpdateEventDetails &updateEventDetails, UaHistoryUpdateResults &results, UaDiagnosticInfos &diagnosticInfos)
 Updates the history of events synchronously on an OPC UA server. More...
 
UaStatus historyDeleteEvents (ServiceSettings &serviceSettings, const DeleteEventDetails &deleteDetails, UaHistoryUpdateResults &results, UaDiagnosticInfos &diagnosticInfos)
 Deletes the history of events synchronously on an OPC UA server for the given EventIds. More...
 
UaStatus beginHistoryReadRawModified (ServiceSettings &serviceSettings, const HistoryReadRawModifiedContext &historyReadRawModifiedContext, const UaHistoryReadValueIds &nodesToRead, OpcUa_UInt32 transactionId)
 Reads the history of item values asynchronously from an OPC UA server. More...
 
UaStatus beginHistoryReadProcessed (ServiceSettings &serviceSettings, const HistoryReadProcessedContext &historyReadProcessedContext, const UaHistoryReadValueIds &nodesToRead, OpcUa_UInt32 transactionId)
 Reads the processed history of item values asynchronously from the OPC UA server based on a passed aggregate. More...
 
UaStatus beginHistoryReadAtTime (ServiceSettings &serviceSettings, const HistoryReadAtTimeContext &historyReadAtTimeContext, const UaHistoryReadValueIds &nodesToRead, OpcUa_UInt32 transactionId)
 Reads the history of item values asynchronously from an OPC UA server for the given timestamps. More...
 
UaStatus beginHistoryReadEvent (ServiceSettings &serviceSettings, const HistoryReadEventContext &historyReadEventContext, const UaHistoryReadValueIds &nodesToRead, OpcUa_UInt32 transactionId)
 Reads the history of events from an event notifier object asynchronously from an OPC UA server. More...
 
UaStatus beginHistoryUpdateData (ServiceSettings &serviceSettings, const UpdateDataDetails &updateDataDetails, OpcUa_UInt32 transactionId)
 Updates the history of item values asynchronously on an OPC UA server. More...
 
UaStatus beginHistoryDeleteRawModified (ServiceSettings &serviceSettings, const DeleteRawModifiedDetails &deleteDetails, OpcUa_UInt32 transactionId)
 Deletes the history of item values asynchronously on an OPC UA server. More...
 
UaStatus beginHistoryDeleteAtTime (ServiceSettings &serviceSettings, const DeleteAtTimeDetails &deleteDetails, OpcUa_UInt32 transactionId)
 Deletes the history of item values asynchronous on an OPC UA server for the given timestamps. More...
 
UaStatus beginHistoryUpdateEvents (ServiceSettings &serviceSettings, const UpdateEventDetails &updateEventDetails, OpcUa_UInt32 transactionId)
 Updates the history of events asynchronously on an OPC UA server. More...
 
UaStatus beginHistoryDeleteEvents (ServiceSettings &serviceSettings, const DeleteEventDetails &deleteDetails, OpcUa_UInt32 transactionId)
 Deletes the history of events asynchronously on an OPC UA server for the given event Ids. More...
 
UaStatus addNodes (ServiceSettings &serviceSettings, const UaAddNodesItems &nodesToAdd, UaAddNodesResults &results, UaDiagnosticInfos &diagnosticInfos)
 Adds a list of nodes to the OPC UA server address space. More...
 
UaStatus addReferences (ServiceSettings &serviceSettings, const UaAddReferencesItems &referencesToAdd, UaStatusCodeArray &results, UaDiagnosticInfos &diagnosticInfos)
 Adds a list of references to the OPC UA server address space. More...
 
UaStatus deleteNodes (ServiceSettings &serviceSettings, const UaDeleteNodesItems &nodesToDelete, UaStatusCodeArray &results, UaDiagnosticInfos &diagnosticInfos)
 Removes a list of nodes from the OPC UA server address space. More...
 
UaStatus deleteReferences (ServiceSettings &serviceSettings, const UaDeleteReferencesItems &referencesToDelete, UaStatusCodeArray &results, UaDiagnosticInfos &diagnosticInfos)
 Removes a list of references from the OPC UA server address space. More...
 
UaStatus beginAddNodes (ServiceSettings &serviceSettings, const UaAddNodesItems &nodesToAdd, OpcUa_UInt32 transactionId)
 Adds a list of nodes asynchronously to the OPC UA server address space. More...
 
UaStatus beginAddReferences (ServiceSettings &serviceSettings, const UaAddReferencesItems &referencesToAdd, OpcUa_UInt32 transactionId)
 Adds a list of references asynchronously to the OPC UA server address space. More...
 
UaStatus beginDeleteNodes (ServiceSettings &serviceSettings, const UaDeleteNodesItems &nodesToDelete, OpcUa_UInt32 transactionId)
 Removes a list of nodes asynchronously from the OPC UA server address space. More...
 
UaStatus beginDeleteReferences (ServiceSettings &serviceSettings, const UaDeleteReferencesItems &referencesToDelete, OpcUa_UInt32 transactionId)
 Removes a list of references asynchronously from the OPC UA server address space. More...
 
UaStatus queryFirst (ServiceSettings &serviceSettings, const OpcUa_ViewDescription &view, const UaNodeTypeDescriptions &nodeTypes, const UaContentFilter &filter, OpcUa_UInt32 maxDataSetsToReturn, OpcUa_UInt32 maxReferencesToReturn, UaByteString &continuationPoint, UaQueryDataSets &queryDataSets, UaDiagnosticInfos &diagnosticInfos, UaParsingResults &parsingResults)
 Query the OPC UA server address space. More...
 
UaStatus queryNext (ServiceSettings &serviceSettings, OpcUa_Boolean releaseContinuationPoint, UaByteString &continuationPoint, UaQueryDataSets &queryDataSets)
 Continues a previous query request. More...
 
UaStatus cancel (ServiceSettings &serviceSettings, OpcUa_UInt32 requestHandle, OpcUa_UInt32 &cancelCount)
 Cancel outstanding service requests in the OPC UA server. More...
 
OpcUa_Boolean isConnected () const
 Flag that indicates if the UaSession is connected. More...
 
UaClient::ServerStatus serverStatus () const
 Provides the actual connection status to the OPC UA server. More...
 
OpcUa_ServerState serverState () const
 Provides the current server state of the OPC UA server. More...
 
UaString currentlyUsedEndpointUrl () const
 Provides the currently used URL for the connection to the OPC UA server. More...
 
UaNodeId sessionId () const
 Provides the sessionId for this connection to the UA server. More...
 
UaByteString serverCertificate () const
 Provides the certificate of the UA server. More...
 
UaStatus getMethodArguments (ServiceSettings &serviceSettings, const UaNodeId &methodId, UaArguments &inputArguments, UaArguments &outputArguments)
 Get a description for the input arguments and output arguments of a method. More...
 
OpcUa_UInt32 connectTimeout () const
 Gets the connect timeout used for connecting to the OPC UA server.
 
void setConnectTimeout (OpcUa_UInt32 connectTimeout)
 Sets the connect timeout used for connecting to the OPC UA server.
 
OpcUa_UInt32 maxOperationsPerServiceCall () const
 Gets the maximum number of operations used for every OPC UA service call.
 
void setMaxOperationsPerServiceCall (OpcUa_UInt32 maxOperationsPerServiceCall)
 Sets the maximum number of operations used for every OPC UA service call.
 
OpcUa_UInt32 watchdogTime () const
 Gets the watchdog time used for connection check and reconnect after connection errors.
 
void setWatchdogTime (OpcUa_UInt32 watchdogTime)
 Sets the watchdog time used for connection check and reconnect after connection errors.
 
OpcUa_UInt32 watchdogTimeout () const
 Gets the watchdog service call timeout used for watchdog read calls.
 
void setWatchdogTimeout (OpcUa_UInt32 watchdogTimeout)
 Sets the watchdog service call timeout used for watchdog read calls.
 
OpcUa_UInt32 revisedSecureChannelLifetime () const
 Gets the secure channel lifetime returned by the server as revised setting.
 
OpcUa_Double revisedSessionTimeout () const
 Gets the session timeout returned by the server as revised setting.
 
UaStringArray getNamespaceTable () const
 Gets the server NamespaceArray property value. More...
 
void updateNamespaceTable ()
 Updates the NamespaceArray from the server property value.
 
virtual
UaDataTypeDictionary::DefinitionType 
definitionType (const UaNodeId &dataTypeId)
 Gets the type (enumeration or structure) of data type for the passed data type NodeId.
 
virtual UaEnumDefinition enumDefinition (const UaNodeId &dataTypeId)
 Gets the enumeration data type description for the passed data type NodeId.
 
virtual UaStructureDefinition structureDefinition (const UaNodeId &dataTypeId)
 Gets the structured data type description for the passed data type NodeId.
 
virtual UaOptionSetDefinition optionSetDefinition (const UaNodeId &dataTypeId)
 Gets the OptionSet data type description for the passed data type NodeId.
 
void loadDataTypeDictionaries ()
 Reads the binary DataTypeDictionaries, parses their content and browses the address space to find the corresponding DataTypeIds and Encoding Ids. More...
 
void clearDataTypeDictionaries ()
 Clears the DataType dictionaries. More...
 
OpcUa_UInt32 maxArrayLength () const
 Returns the maximum array length that can be used for the communication with the server. More...
 
OpcUa_UInt32 maxStringLength () const
 Returns the maximum String length that can be used for the communication with the server. More...
 
OpcUa_UInt32 maxByteStringLength () const
 Returns the maximum ByteString length that can be used for the communication with the server. More...
 
- Public Member Functions inherited from UaDataTypeDictionary
DefinitionType definitionType (const UaVariant &vValue)
 Returns the UaDataTypeDictionary::DefinitionType of a variant. More...
 
DefinitionType definitionType (const UaExtensionObject &vValue)
 Returns the UaDataTypeDictionary::DefinitionType of an ExtensionObject. More...
 
UaStructureDefinition structureDefinition (const UaVariant &vValue)
 Returns the UaStructureDefinition of a variant. More...
 
UaStructureDefinition structureDefinition (const UaExtensionObject &vValue)
 Returns the UaStructureDefinition of an ExtensionObject. More...
 

Static Public Member Functions

static char * getHostFromUrl (const OpcUa_String *pURL, bool expandIPv6)
 Extract and return the IP address or hostname from an URL. More...
 

Protected Member Functions

virtual bool verificationError (SessionSecurityInfo *pInfo, OpcUa_Void *pvVerifyContext, const UaByteString &certificateChain, OpcUa_StatusCode uVerificationResult, OpcUa_UInt32 uDepth)
 Callback method to inform about errors during certificate validation. More...
 

Additional Inherited Members

- Public Types inherited from UaDataTypeDictionary
enum  DefinitionType
 Enumeration that indicates whether a UaEnumDefinition or a UaStructureDefinition is available.
 

Detailed Description

The UaSession class manges a UA Client side application session.

This is the main class for connecting with any OPC UA Server. The class manages the connection to an OPC Unified Architecture server and the application session established with the server. The class provides all non Subscription related UA Services as synchronous and asynchronous methods.

The connect call establishes and maintains a Session with a Server. After a successful connect, the connection is monitored by the SDK. Connection status changes are reported through the callback UaSessionCallback::connectionStatusChanged.

A UaSession object is thread-safe.

Constructor & Destructor Documentation

UaSession::UaSession ( UaSession pOther)

Creates a UaSession client object with a reference the connection from the other UaSession.

Parameters
[in]pOtherPointer to UaSession with connection to reference

Member Function Documentation

UaStatus UaSession::addNodes ( ServiceSettings serviceSettings,
const UaAddNodesItems nodesToAdd,
UaAddNodesResults results,
UaDiagnosticInfos &  diagnosticInfos 
)

Adds a list of nodes to the OPC UA server address space.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]nodesToAddList of nodes to add to the server.
[out]resultsList of the add node results.
[out]diagnosticInfosList of the add node diagnostic information.
UaStatus UaSession::addReferences ( ServiceSettings serviceSettings,
const UaAddReferencesItems referencesToAdd,
UaStatusCodeArray results,
UaDiagnosticInfos &  diagnosticInfos 
)

Adds a list of references to the OPC UA server address space.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]referencesToAddThe list of references to add to the server.
[out]resultsList of the add reference results.
[out]diagnosticInfosList of the add reference diagnostic information.
UaStatus UaSession::beginAddNodes ( ServiceSettings serviceSettings,
const UaAddNodesItems nodesToAdd,
OpcUa_UInt32  transactionId 
)

Adds a list of nodes asynchronously to the OPC UA server address space.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]nodesToAddList of nodes to add to the server.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction.
UaStatus UaSession::beginAddReferences ( ServiceSettings serviceSettings,
const UaAddReferencesItems referencesToAdd,
OpcUa_UInt32  transactionId 
)

Adds a list of references asynchronously to the OPC UA server address space.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]referencesToAddList of references to add to the server.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction.
UaStatus UaSession::beginCall ( ServiceSettings serviceSettings,
const CallIn callRequest,
OpcUa_UInt32  transactionId 
)

Calls a method of an Object on the OPC UA server.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]callRequestObject and Method to call and input arguments. See CallIn for more details.
[out]transactionIdOutput arguments and input argument results. See CallOut for more details.
UaStatus UaSession::beginDeleteNodes ( ServiceSettings serviceSettings,
const UaDeleteNodesItems nodesToDelete,
OpcUa_UInt32  transactionId 
)

Removes a list of nodes asynchronously from the OPC UA server address space.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]nodesToDeleteList of nodes to delete from the server address space.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction.
UaStatus UaSession::beginDeleteReferences ( ServiceSettings serviceSettings,
const UaDeleteReferencesItems referencesToDelete,
OpcUa_UInt32  transactionId 
)

Removes a list of references asynchronously from the OPC UA server address space.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]referencesToDeleteList of references to delete from the server address space.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction.
UaStatus UaSession::beginHistoryDeleteAtTime ( ServiceSettings serviceSettings,
const DeleteAtTimeDetails deleteDetails,
OpcUa_UInt32  transactionId 
)

Deletes the history of item values asynchronous on an OPC UA server for the given timestamps.

See historyDeleteAtTime for more details.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]deleteDetailsThe list of nodes to delete data from at a given time.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction.
UaStatus UaSession::beginHistoryDeleteEvents ( ServiceSettings serviceSettings,
const DeleteEventDetails deleteDetails,
OpcUa_UInt32  transactionId 
)

Deletes the history of events asynchronously on an OPC UA server for the given event Ids.

See historyDeleteEvents for more details.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]deleteDetailsThe list of nodes to delete events from with the given EventIds.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction.
UaStatus UaSession::beginHistoryDeleteRawModified ( ServiceSettings serviceSettings,
const DeleteRawModifiedDetails deleteDetails,
OpcUa_UInt32  transactionId 
)

Deletes the history of item values asynchronously on an OPC UA server.

See historyDeleteRawModified for more details.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]deleteDetailsThe list of nodes to delete data from in a given time range.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction.
UaStatus UaSession::beginHistoryReadAtTime ( ServiceSettings serviceSettings,
const HistoryReadAtTimeContext historyReadAtTimeContext,
const UaHistoryReadValueIds nodesToRead,
OpcUa_UInt32  transactionId 
)

Reads the history of item values asynchronously from an OPC UA server for the given timestamps.

See historyReadAtTime for more details.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]historyReadAtTimeContextConfiguration parameters for the history read data at time.

Configuration parameters include
  • Array of timestamps for which values are to be read
  • Flag for bounding value calculation

See HistoryReadAtTimeContext for more details.
[in]nodesToReadList of variable nodes to read data values at specified timestamps from.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction
UaStatus UaSession::beginHistoryReadEvent ( ServiceSettings serviceSettings,
const HistoryReadEventContext historyReadEventContext,
const UaHistoryReadValueIds nodesToRead,
OpcUa_UInt32  transactionId 
)

Reads the history of events from an event notifier object asynchronously from an OPC UA server.

See historyReadEvent for more details.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]historyReadEventContextConfiguration parameters for the history read of events.

Configuration parameters include
  • The start time of the requested time domain
  • The end time of the requested time domain
  • The event filter
  • Limitation of the number of results per node

See HistoryReadEventContext for more details.
[in]nodesToReadList of event notifier object nodes to read event history from
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction
UaStatus UaSession::beginHistoryReadProcessed ( ServiceSettings serviceSettings,
const HistoryReadProcessedContext historyReadProcessedContext,
const UaHistoryReadValueIds nodesToRead,
OpcUa_UInt32  transactionId 
)

Reads the processed history of item values asynchronously from the OPC UA server based on a passed aggregate.

See historyReadProcessed for more details.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]historyReadProcessedContextConfiguration parameters for the history read processed data.

Configuration parameters include
  • The start time of the requested time interval
  • The end time of the requested time interval
  • Time processing interval used to calculate one aggregated value from the raw values
  • The NodeId of the aggregate used for the calculation of the values

See HistoryReadProcessedContext for more details.
[out]nodesToReadList of variable nodes to read processed data history from. Includes a continuation point to continue previous read requests.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction
UaStatus UaSession::beginHistoryReadRawModified ( ServiceSettings serviceSettings,
const HistoryReadRawModifiedContext historyReadRawModifiedContext,
const UaHistoryReadValueIds nodesToRead,
OpcUa_UInt32  transactionId 
)

Reads the history of item values asynchronously from an OPC UA server.

See historyReadRawModified for more details.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]historyReadRawModifiedContextConfiguration parameters for the history read of raw or modified data.

Configuration parameters include
  • Flag indicating whether raw or modified data should be read
  • The start time of the requested time interval
  • The end time of the requested time interval
  • Setting whether bounding values should be returned
  • Limitation of the number of results per node

See HistoryReadRawModifiedContext for more details.
[in]nodesToReadList of variable nodes to read data history from. It includes a continuation point per node to continue previous read requests.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction.
UaStatus UaSession::beginHistoryUpdateData ( ServiceSettings serviceSettings,
const UpdateDataDetails updateDataDetails,
OpcUa_UInt32  transactionId 
)

Updates the history of item values asynchronously on an OPC UA server.

See historyUpdateData for more details.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]updateDataDetailsThe list of variable nodes to update including the data provided for the update. See UpdateDataDetail for more details.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction
UaStatus UaSession::beginHistoryUpdateEvents ( ServiceSettings serviceSettings,
const UpdateEventDetails updateEventDetails,
OpcUa_UInt32  transactionId 
)

Updates the history of events asynchronously on an OPC UA server.

See historyUpdateEvents for more details.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]updateEventDetailsThe list of nodes to update including the events provided for the update.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction.
UaStatus UaSession::beginRead ( ServiceSettings serviceSettings,
OpcUa_Double  maxAge,
OpcUa_TimestampsToReturn  timeStamps,
const UaReadValueIds nodesToRead,
OpcUa_UInt32  transactionId 
)

Reads attribute values asynchronously from an OPC UA server.

See read for more details. The values and operation level results are returned in readComplete.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]maxAgeMaximum age of the values to return. See read for more details.
[in]timeStampsType of timestamps to return. See read for more details.
[in]nodesToReadList of Nodes and Attributes to read.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction.
UaStatus UaSession::beginWrite ( ServiceSettings serviceSettings,
const UaWriteValues nodesToWrite,
OpcUa_UInt32  transactionId 
)

Writes variable values asynchronously to an OPC UA server.

See write for more details. The operation level results are returned in writeComplete.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]nodesToWriteList of Nodes, Attributes and the values to write.
[in]transactionIdTransaction ID for the asynchronous call used to assign the callback to the transaction.
UaStatus UaSession::browse ( ServiceSettings serviceSettings,
const UaNodeId nodeToBrowse,
const BrowseContext browseContext,
UaByteString continuationPoint,
UaReferenceDescriptions referenceDescriptions 
)

Browse OPC UA server Address Space with a single starting Node.

The Browse Service is used by a client to navigate through the address space by passing a starting Node and browse filters. The server returns the list of referenced nodes matching the filter criteria.

The Browse Service takes a list of starting Nodes and returns a list of connected Nodes for each starting Node. Nevertheless, most clients will only pass one starting Node for the main purpose of building a tree hierarchy. Since the OPC UA Address Space can be a full-meshed network and is not limited to a pure hierarchy, the capability to pass in a list of starting Nodes is mainly used to browse metadata like the Properties of a list of Variables. The client SDK provides different browse methods, one for a single starting Node and one for a list of starting Nodes.

This simplified browse method is used for a single starting Node.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]nodeToBrowseNodeId of the starting Node.
[in]browseContextFilter settings for the Browse call. See BrowseContext for more details.
[out]continuationPointA continuation point is returned when the server was not able to deliver all results in the Browse response. The limitation can be set by the client in the request or by the server during Browse processing. The continuation point can be passed to browseNext to get the remaining results.
[out]referenceDescriptionsList of references and target Node information for the Nodes passing the filter criteria set in the request.
UaStatus UaSession::browseList ( ServiceSettings serviceSettings,
const OpcUa_ViewDescription viewDescription,
OpcUa_UInt32  maxReferencesToReturn,
const UaBrowseDescriptions browseDescription,
UaBrowseResults browseResults,
UaDiagnosticInfos &  diagnosticInfos 
)

Browse OPC UA server Address Space with a list of starting Nodes.

The Browse Service is used by a client to navigate through the Address Space by passing starting Nodes and browse filters. The server returns the list of referenced Nodes matching the filter criteria.

The Browse Service takes a list of starting Nodes and returns a list of connected Nodes for each starting Node. Nevertheless, most clients will only pass one starting Node for the main purpose of building a tree hierarchy. Since the OPC UA Address Space can be a full-meshed network and is not limited to a pure hierarchy, the capability to pass in a list of starting Nodes is mainly used to browse metadata like the Properties of a list of Variables. The client SDK provides different browse methods, one for a single starting Node and one for a list of starting Nodes.

This browse method is used for a a list of starting Nodes.

UaStatus UaSession::browseListNext ( ServiceSettings serviceSettings,
OpcUa_Boolean  releaseContinuationPoint,
const UaByteStringArray continuationPoints,
UaBrowseResults browseResults,
UaDiagnosticInfos &  diagnosticInfos 
)

Continue a previous browseList request.

This method is only used to continue a browse started with the browseList method if not all results could be returned by the browseList or a following browseListNext call. The number of Nodes to return can be limited by the client in the browse request or by the Server during processing the Browse Service call.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]releaseContinuationPointA flag that indicates whether the method is called only for releasing the memory associated with the continuation point in the server or the next set of results should be returned. Clients should always call this Service even if they do not want to continue browsing. In this case this flag is set to true.
[in]continuationPointsContinuation points returned from a previous browseList or browseListNext call. Continuation points are returned in browseResult when the server was not able to deliver all results in the BrowseNext response. The limitation can be set by the client in the Browse or by the server during BrowseNext processing. The continuation point can be passed to browseNext to get the remaining results.
[out]browseResultsList of Browse results containing references and target Node information for the Nodes passing the filter criteria set in the first Browse call.
[out]diagnosticInfosList of diagnostic information
UaStatus UaSession::browseNext ( ServiceSettings serviceSettings,
OpcUa_Boolean  releaseContinuationPoint,
UaByteString continuationPoint,
UaReferenceDescriptions referenceDescriptions 
)

Continue a previous Browse request.

This method is only used to continue a Browse started with the browse method if not all results could be returned by the browse or a following browseNext call. The number of Nodes to return can be limited by the client in the Browse request or by the Server during processing the Browse Service call.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]releaseContinuationPointA flag that indicates whether the method is called only for releasing the memory associated with the continuation point in the server or the next set of results should be returned. Clients should always call this Service even if they do not want to continue browsing. In this case, this flag is set to true.
[in,out]continuationPointContinuation points returned from a previous browse or browseNext call. A continuation point is returned when the server was not able to deliver all results in the BrowseNext response. The limitation can be set by the client in the browse or by the server during BrowseNext processing. The continuation point can be passed to browseNext to get the remaining results.
[out]referenceDescriptionsList of references and target Node information for the Nodes passing the filter criteria set in the first browse call.
UaStatus UaSession::call ( ServiceSettings serviceSettings,
const CallIn callRequest,
CallOut callResponse 
)

Calls a method of an Object on the OPC UA server.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]callRequestObject and Method to call and input arguments. See CallIn for more details.
[out]callResponseOutput arguments and input argument results. See CallOut for more details.
UaStatus UaSession::callList ( ServiceSettings serviceSettings,
const UaCallMethodRequests callMethodRequests,
UaCallMethodResults callMethodResults,
UaDiagnosticInfos &  diagnosticInfos 
)

Calls a list of methods of Objects on the OPC UA server.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]callMethodRequestsList of Objects and Methods to call including input arguments.
[out]callMethodResultsList of output arguments and input argument results for each requested method call.
[out]diagnosticInfosList of diagnostic information
UaStatus UaSession::cancel ( ServiceSettings serviceSettings,
OpcUa_UInt32  requestHandle,
OpcUa_UInt32 &  cancelCount 
)

Cancel outstanding service requests in the OPC UA server.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]requestHandleRequest handle used for the outstanding service requests to cancel. The request handle is either set by the caller in the ServiceSettings or is assigned by the SDK. If assigned by the SDK it can be read from the ServiceSettings in the case of asynchronous calls.
[out]cancelCountNumber of canceled service request in the server.
UaStatus UaSession::changeUser ( ServiceSettings serviceSettings,
UaUserIdentityToken pUserIdentityToken 
)

Change user for the connection to the OPC UA server.

Calling this function changes the user of the session by calling ActivateSession with the new user identity.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]pUserIdentityTokenThe passed object can be an instance of UaUserIdentityTokenAnonymous for the user type Anonymous and UaUserIdentityTokenUserPassword for the user type UserPassword.
void UaSession::clearDataTypeDictionaries ( )

Clears the DataType dictionaries.

Call this method if a DataType dictionary has changed—e.g. the NodeVersion property of the dictionary node has changed—and you do not want to load the DataType dictionaries directly.

UaStatus UaSession::connect ( const UaString sURL,
SessionConnectInfo sessionConnectInfo,
SessionSecurityInfo sessionSecurityInfo,
UaSessionCallback pSessionCallback 
)

Establish a connection to the OPC UA server.

Calling this function successfully creates a secure channel to the server endpoint and it creates and activates an application session in the server application.

The SDK is managing the connection to the server by

  • Monitoring the status of the session with read calls to the server status variable. The frequency of the read calls can be controlled with the setting SessionConnectInfo::nWatchdogTime
  • Reconnect on TCP/IP or SecureChannel level if the connection was lost
  • Recreation of the session if the session timed out or the server was restarted
  • The callback function UaSessionCallback::connectionStatusChanged provides information about the current status of the session

The Security section of the client SDK introduction contains a detailed description on how the certificate store is set up, on how application instance certificates are created and how an secure connection to a server is initiated.

Returns
Result status code of the connect call.
  • OpcUa_Good if the connect succeeded
  • OpcUa_GoodCompletesAsynchronously if the connect failed but the client SDK tries again in the background until the connect succeeds or disconnect is called
  • OpcUa_Badxxx if the connect fails and there is no retry requested through SessionConnectInfo::bRetryInitialConnect
Parameters
[in]sURLThe URL identifying an OPC UA Server.
[in,out]sessionConnectInfoThe client defined session connect settings. See SessionConnectInfo for more info.
[in,out]sessionSecurityInfoThe client defined session security settings. See SessionSecurityInfo for more info.
[in]pSessionCallbackPointer to callback interface for session object. See UaSessionCallback for more details.
UaStatus UaSession::createSubscription ( ServiceSettings serviceSettings,
UaSubscriptionCallback pUaSubscriptionCallback,
OpcUa_UInt32  clientSubscriptionHandle,
SubscriptionSettings subscriptionSettings,
OpcUa_Boolean  publishingEnabled,
UaSubscription **  ppUaSubscription 
)

Creates a subscription.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]pUaSubscriptionCallbackCallback interface for the subscription used to send data changes, events and subscription status changes to the client application.
[in]clientSubscriptionHandleClient defined handle for the subscription. This handle is used to identify the subscription in the callback methods. It is only necessary for subscription identification if the callback object is used for more than one subscription.
[in,out]subscriptionSettingsRequested and revised subscription settings like publish interval and keep alive counter
[in]publishingEnabledFlag indicating whether publishing is enabled or disabled.
[out]ppUaSubscriptionClient side subscription created by the session object. This object must be passed to deleteSubscription to clean up resources even if the subscription is already deleted in the server.
UaString UaSession::currentlyUsedEndpointUrl ( ) const

Provides the currently used URL for the connection to the OPC UA server.

This is normally the URL passed as parameter to UaSession::connect(). But it can also be one of the URLs from SessionConnectInfo::alternativeEndpointUrls if such alternative URLs are provided and the main endpoint is not available.

UaStatus UaSession::deleteNodes ( ServiceSettings serviceSettings,
const UaDeleteNodesItems nodesToDelete,
UaStatusCodeArray results,
UaDiagnosticInfos &  diagnosticInfos 
)

Removes a list of nodes from the OPC UA server address space.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]nodesToDeleteThe list of nodes to delete from the server. Each entry contains the NodeId and a flag if target references should be deleted.
[out]resultsList of the delete node result status codes.
[out]diagnosticInfosList of the delete node diagnostic information.
UaStatus UaSession::deleteReferences ( ServiceSettings serviceSettings,
const UaDeleteReferencesItems referencesToDelete,
UaStatusCodeArray results,
UaDiagnosticInfos &  diagnosticInfos 
)

Removes a list of references from the OPC UA server address space.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]referencesToDelete
[out]results
[out]diagnosticInfos
UaStatus UaSession::deleteSubscription ( ServiceSettings serviceSettings,
UaSubscription **  ppUaSubscription,
OpcUa_UInt32  waitTimeForTransactionCompletion = 100 
)

Deletes a subscription.

This method allows to delete a subscription from the session. It also clears the Client SDK subscription management and deletes the client side subscription object. This method should also be called if the subscription is already invalid on the server to clear the client side objects.

The deleteSubscription blocks for waitTimeForTransactionCompletion until all outstanding service calls for the UaSubscription object are finished and results are returned. This includes any asynchronous service calls and outstanding callbacks to the client application, including the ones for related UaSubscription objects.

If the method returns OpcUa_GoodCompletesAsynchronously, not all transactions are completed and callbacks for this UaSubscription may arrive until UaSession::disconnect. The deletion of the internal management of the UaSubscription is executed in a worker thread.

If all transactions are completed, no more callbacks will be sent for this UaSubscription object.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in,out]ppUaSubscriptionThe subscription object pointer. The inner pointer to the subscription object will be set to NULL when deleted.
[in]waitTimeForTransactionCompletionWait time for transaction completion in milliseconds. A wait time of 0 is infinite.
UaStatus UaSession::disconnect ( ServiceSettings serviceSettings,
OpcUa_Boolean  bDeleteSubscriptions 
)

Disconnect client application from OPC UA server.

Calling this function closes the session and the secure channel connection to the server. The subscriptions assigned to the session are also deleted if the flag bDeleteSubscriptions is set to OpcUa_True. If subscriptions should be transfered to other sessions, the flag bDeleteSubscriptions must be set to OpcUa_False. The client side subscription objects are deleted regardless of the bDeleteSubscriptions setting.

The disconnect is completed and the status is changed to disconnected even if the CloseSession service fails and the bad status is returned by this function.

After UaSession::disconnect is called, no more callbacks will be sent for this UaSession object and related UaSubscription objects. The disconnect blocks until all outstanding service calls are finished and results are returned. This includes any asynchronous service calls and outstanding callbacks to the client application including the ones for related UaSubscription objects.

It is not allowed to block the execution of callbacks when UaSession::disconnect is called. This will lead to a deadlock of the client application.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]bDeleteSubscriptionsFlag to indicate whether all subscriptions assigned to the session should be deleted.
char * UaSession::getHostFromUrl ( const OpcUa_String pURL,
bool  expandIPv6 
)
static

Extract and return the IP address or hostname from an URL.

IPv6 allows to ommit leading zeroes and complete blocks of zeroes replaced by ::. When the expandIPv6 flag is set then all ommited zeroes are added to obtain a 39 character long string. The caller needs to free the return string.

UaStatus UaSession::getMethodArguments ( ServiceSettings serviceSettings,
const UaNodeId methodId,
UaArguments inputArguments,
UaArguments outputArguments 
)

Get a description for the input arguments and output arguments of a method.

The UaArguments contain the Name, DataType, ValueRank, ArrayDimensions and Description for each method argument. Returns Good if reading the InputArguments and OutputArguments succeeds. Otherwise return a specific error code.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]methodIdThe NodeId of the Method to request the arguments for
[out]inputArgumentsThe list of InputArguments.
[out]outputArgumentsThe list of OutputArguments.
UaStringArray UaSession::getNamespaceTable ( ) const

Gets the server NamespaceArray property value.

The NamespaceArray is read from the server at connect and reconnect. It can be updated on request with the method updateNamespaceTable().

UaStatus UaSession::historyDeleteAtTime ( ServiceSettings serviceSettings,
const DeleteAtTimeDetails deleteDetails,
UaHistoryUpdateResults results,
UaDiagnosticInfos &  diagnosticInfos 
)

Deletes the history of item values synchronously on an OPC UA server for the given timestamps.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]deleteDetailsThe list of nodes to delete data from at a given time
[out]resultsThe list of update results
[out]diagnosticInfosThe list of diagnostic information for the update results
UaStatus UaSession::historyDeleteEvents ( ServiceSettings serviceSettings,
const DeleteEventDetails deleteDetails,
UaHistoryUpdateResults results,
UaDiagnosticInfos &  diagnosticInfos 
)

Deletes the history of events synchronously on an OPC UA server for the given EventIds.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]deleteDetailsThe list of nodes to delete events from with the given EventIds.
[out]resultsThe list of update results.
[out]diagnosticInfosThe list of diagnostic information for the update results.
UaStatus UaSession::historyDeleteRawModified ( ServiceSettings serviceSettings,
const DeleteRawModifiedDetails deleteDetails,
UaHistoryUpdateResults results,
UaDiagnosticInfos &  diagnosticInfos 
)

Deletes the history of item values synchronously on an OPC UA server.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]deleteDetailsThe list of nodes to delete data from in a given time range.
[out]resultsThe list of update results.
[out]diagnosticInfosThe list of diagnostic information for the update results.
UaStatus UaSession::historyReadAtTime ( ServiceSettings serviceSettings,
const HistoryReadAtTimeContext historyReadAtTimeContext,
const UaHistoryReadValueIds nodesToRead,
HistoryReadDataResults results,
UaDiagnosticInfos &  diagnosticInfos 
)

Reads the history of item values synchronously from an OPC UA server for the given timestamps.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]historyReadAtTimeContextConfiguration parameters for the history read data at time.

Configuration parameters include
  • Array of timestamps for which values are to be read
  • Flag for bounding value calculation

See HistoryReadAtTimeContext for more details.
[in]nodesToReadList of variable nodes to read data values at specified timestamps from.
[out]resultsResult data for the requested nodes and timestamps
[out]diagnosticInfosList of diagnostic information
UaStatus UaSession::historyReadEvent ( ServiceSettings serviceSettings,
const HistoryReadEventContext historyReadEventContext,
const UaHistoryReadValueIds nodesToRead,
HistoryReadEventResults results,
UaDiagnosticInfos &  diagnosticInfos 
)

Reads the event history for a list of event notifier objects synchronously from an OPC UA server.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]historyReadEventContextConfiguration parameters for the history read of events.

Configuration parameters include
  • The start time of the requested time domain
  • The end time of the requested time domain
  • The event filter
  • Limitation of the number of results per node

See HistoryReadEventContext for more details.
[in]nodesToReadList of event notifier object nodes to read event history from.
[out]resultsThe event history for each notifier.
[out]diagnosticInfosList of diagnostic information.
UaStatus UaSession::historyReadProcessed ( ServiceSettings serviceSettings,
const HistoryReadProcessedContext historyReadProcessedContext,
const UaHistoryReadValueIds nodesToRead,
HistoryReadDataResults results,
UaDiagnosticInfos &  diagnosticInfos 
)

Reads the processed history of variable values synchronously from the OPC UA server based on a passed aggregate.

This method is used to read processed historical values of one or more nodes in an ordered sequence for the defined time domain. Continuation points are used to continue the read of the ordered sequence if not all data can be returned in one read or if the server was not able to finish the processing before the timeout expired. The returned number can be limited by the server and may be 0 if the server was not able to finish one calculation before the service timeout expired.

The processed values are calculated with the specified aggregate based on the raw data in the history database. The server must use start time, end time, and the resample interval to generate a sequence of time intervals and then calculate an aggregate for each interval.

Predefined aggregates are:

Define for aggregate function Description
OpcUaId_AggregateFunction_Interpolative This is used for retrieving the interpolated value at the beginning of each interval.
OpcUaId_AggregateFunction_Average Returns the average data over the resample interval. It adds up all values in the interval and divides the sum by the number of values.
OpcUaId_AggregateFunction_TimeAverage Returns the time weighted average data over the resample interval. A straight line is drawn between each raw value in the interval. The area under the line is divided by the length of the interval to yield the average. Interpolated values are used at the start and at the end of the interval.
OpcUaId_AggregateFunction_TimeAverage2 Retrieve the time weighted average data over the interval using Simple Bounding Values.
OpcUaId_AggregateFunction_Total Retrieve the total (time integral) of the data over the interval using Interpolated Bounding Values.
OpcUaId_AggregateFunction_Total2 Retrieve the total (time integral) of the data over the interval using Simple Bounding Values.
OpcUaId_AggregateFunction_Minimum Returns the minimum value in the resample interval.
OpcUaId_AggregateFunction_Maximum Returns the maximum value in the resample interval.
OpcUaId_AggregateFunction_MinimumActualTimeReturns the minimum value in the resample interval and the timestamp of the minimum value.
OpcUaId_AggregateFunction_MaximumActualTimeReturns the maximum value in the resample interval and the timestamp of the maximum value.
OpcUaId_AggregateFunction_Range Retrieve the difference between the minimum and maximum Value over the interval.
OpcUaId_AggregateFunction_Range2 Retrieve the difference between the Minimum2 and Maximum2 value over the interval.
OpcUaId_AggregateFunction_AnnotationCountReturns the number of annotations in the resample interval. Annotations are user entered comments in the history database.
OpcUaId_AggregateFunction_Count Returns the number of raw values with good status in the resample interval.
OpcUaId_AggregateFunction_DurationInStateZeroRetrieve the time at which a Boolean or numeric was in a non-zero state using Simple Bounding Values.
OpcUaId_AggregateFunction_DurationInStateNonZeroRetrieve the time at which a Boolean or numeric was in a non-zero state using Simple Bounding Values.
OpcUaId_AggregateFunction_NumberOfTransitionsRetrieve the number of changes between zero and non-zero a Boolean or numeric value experienced in the interval.
OpcUaId_AggregateFunction_Start Returns the first value in the interval and the timestamp of the first value.
OpcUaId_AggregateFunction_End Returns the last value in the interval and the timestamp of the last value.
OpcUaId_AggregateFunction_Delta The difference between the first and the last good value in the interval. If the last value is less than the first value, the result will be negative.
OpcUaId_AggregateFunction_DurationGood The duration of the interval the value had good quality. The value of the aggregate is the time in milliseconds.
OpcUaId_AggregateFunction_DurationBad The duration of the interval the value had bad quality. The value of the aggregate is the time in milliseconds.
OpcUaId_AggregateFunction_PercentGood Percentage of the interval the value had good quality (0-100).
PercentGood = DurationGood / ResampleInterval * 100.
OpcUaId_AggregateFunction_PercentBad Percentage of the interval the value had bad quality (0-100).
PercentGood = DurationGood / ResampleInterval * 100.
OpcUaId_AggregateFunction_WorstQuality Retrieve the worst StatusCode of data in the interval.
OpcUaId_AggregateFunction_WorstQuality2 Retrieve the worst StatusCode of data in the interval including the Simple Bounding Values.
OpcUaId_AggregateFunction_StandardDeviationSampleRetrieve the standard deviation for the interval for a sample of the population (n-1) including the Simple Bounding Values.
OpcUaId_AggregateFunction_VarianceSample Retrieve the variance for the interval for a sample of the population.
OpcUaId_AggregateFunction_StandardDeviationPopulation Retrieve the standard deviation for the interval for a complete population (n) including the Simple Bounding Values.
OpcUaId_AggregateFunction_VariancePopulation Retrieve the variance for the interval for the complete population.
Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]historyReadProcessedContextConfiguration parameters for the history read processed data.

Configuration parameters include
  • The start time of the requested time interval
  • The end time of the requested time interval
  • Time processing interval used to calculate one aggregated value from the raw values
  • The NodeId of the aggregate used for the calculation of the values

See HistoryReadProcessedContext for more details.
[out]nodesToReadList of variable nodes to read processed data history from. Includes a continuation point to continue previous read requests.
[out]resultsResult data for the requested nodes, time domain, and aggregates. A continuation point is included for a node if not all results could be returned or processed before the timeout expired.
[out]diagnosticInfosList of diagnostic information.
UaStatus UaSession::historyReadRawModified ( ServiceSettings serviceSettings,
const HistoryReadRawModifiedContext historyReadRawModifiedContext,
const UaHistoryReadValueIds nodesToRead,
HistoryReadDataResults results,
UaDiagnosticInfos &  diagnosticInfos 
)

Reads the history of variable values synchronously from an OPC UA server.

This method is used to read raw or modified historical values of one or more nodes in an ordered sequence for the defined time domain. Continuation points are used to continue the read of the ordered sequence if not all data can be returned in one read. The returned number can be limited by the client or the server.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]historyReadRawModifiedContextConfiguration parameters for the history read of raw or modified data.

Configuration parameters include
  • Flag indicating whether raw or modified data should be read
  • The start time of the requested time interval
  • The end time of the requested time interval
  • Setting whether bounding values should be returned
  • Limitation of the number of results per node

See HistoryReadRawModifiedContext for more details.
[in]nodesToReadList of variable nodes to read data history from. It includes a continuation point per node to continue previous read requests.
[out]resultsResult data for the requested nodes and time interval. A continuation point is included for a node if not all results could be returned.
[out]diagnosticInfosList of diagnostic information.
UaStatus UaSession::historyUpdateData ( ServiceSettings serviceSettings,
const UpdateDataDetails updateDataDetails,
UaHistoryUpdateResults results,
UaDiagnosticInfos &  diagnosticInfos 
)

Updates the history of variable values synchronously on an OPC UA server.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]updateDataDetailsThe list of variable nodes to update including the data provided for the update. See UpdateDataDetail for more details.
[out]resultsThe list of update results.
[out]diagnosticInfosThe list of diagnostic information for the update results.
UaStatus UaSession::historyUpdateEvents ( ServiceSettings serviceSettings,
const UpdateEventDetails updateEventDetails,
UaHistoryUpdateResults results,
UaDiagnosticInfos &  diagnosticInfos 
)

Updates the history of events synchronously on an OPC UA server.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]updateEventDetailsThe list of nodes to update including the events provided for the update.
[out]resultsThe list of update results.
[out]diagnosticInfosThe list of diagnostic information for the update results.
OpcUa_Boolean UaSession::isConnected ( ) const

Flag that indicates if the UaSession is connected.

This flag does not reflect the actual server status indicating the real connection status to the server. The flag is set to true after connect was successfully called and is set to false if disconnect is called. The connection status to the UA server can be different in connection error scenarios.

See also
serverStatus
void UaSession::loadDataTypeDictionaries ( )

Reads the binary DataTypeDictionaries, parses their content and browses the address space to find the corresponding DataTypeIds and Encoding Ids.

Ignores DataTypes where DataTypeIds cannot be found. If SUPPORT_XML_PARSER is disabled, it will only load the known type dictionary of namespace 0.

OpcUa_UInt32 UaSession::maxArrayLength ( ) const

Returns the maximum array length that can be used for the communication with the server.

The MaxArrayLength Property indicates the maximum length of a one or multidimensional array supported by Variables of the Server. In a multidimensional array it indicates the overall length. For example, a three-dimensional array of 2x3x10 has the array length of 60. The Server might further restrict the length for individual Variables without notice to the client. Servers may use the Property MaxArrayLength defined in Part 3 on individual DataVariables to specify the size on individual values. The individual Property may have a larger or smaller value than MaxArrayLength.

OpcUa_UInt32 UaSession::maxByteStringLength ( ) const

Returns the maximum ByteString length that can be used for the communication with the server.

The MaxByteStringLength Property indicates the maximum number of Bytes in a ByteString supported by Variables or FileType Objects of the Server. The Server might further restrict the ByteString length for individual Variables or FileType Objects without notice to the Client. Servers may use the Property MaxByteStringLength on individual DataVariables to specify the length on individual values or on FileType Objects to specify the maximum size of read and write buffers. The individual Property may have larger or smaller values than MaxByteStringLength.

OpcUa_UInt32 UaSession::maxStringLength ( ) const

Returns the maximum String length that can be used for the communication with the server.

The MaxStringLength Property indicates the maximum number of characters in Strings supported by Variables of the Server. The Server might further restrict the String length for individual Variables without notice to the client. Servers may use the Property MaxStringLength defined in Part 3 on individual DataVariables to specify the length on individual values. The individual Property may have larger or smaller values than MaxStringLength.

UaStatus UaSession::queryFirst ( ServiceSettings serviceSettings,
const OpcUa_ViewDescription view,
const UaNodeTypeDescriptions nodeTypes,
const UaContentFilter filter,
OpcUa_UInt32  maxDataSetsToReturn,
OpcUa_UInt32  maxReferencesToReturn,
UaByteString continuationPoint,
UaQueryDataSets queryDataSets,
UaDiagnosticInfos &  diagnosticInfos,
UaParsingResults parsingResults 
)

Query the OPC UA server address space.

This Service is used to issue a Query request to the Server. The complexity of the Query can range from very simple to highly sophisticated. The Query can simply request data from instances of a TypeDefinitionNode or TypeDefinitionNode subject to restrictions specified by the filter. On the other hand, the Query can request data from instances of related Node types by specifying a RelativePath from an originating TypeDefinitionNode.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]viewView used for the query. Null view means the whole address space.
[in]nodeTypesSelection of nodes or references based on the type definition for the starting node and a browse path to its component(s).
[in]filterResulting Nodes shall be limited to the Nodes matching the criteria defined by the filter.
[in]maxDataSetsToReturnThe number of QueryDataSets that the Client wants the Server to return in the response.
[in]maxReferencesToReturnThe number of References that the Client wants the Server to return in the response for each QueryDataSet
[out]continuationPointA continuation point is returned when the server was not able to deliver all results in the Query response. The limitation can be set by the client in the request or by the server during Query processing. The continuation point can be passed to queryNext to get the remaining results.
[out]queryDataSetsList of query data results.
[out]diagnosticInfosList of diagnostic information.
[out]parsingResultsList of parsing results for QueryFirst. The size and order of the list matches the size and order of the nodeTypes request parameter.
UaStatus UaSession::queryNext ( ServiceSettings serviceSettings,
OpcUa_Boolean  releaseContinuationPoint,
UaByteString continuationPoint,
UaQueryDataSets queryDataSets 
)

Continues a previous query request.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]releaseContinuationPointA flag that indicates whether the method is called only for releasing the memory associated with the continuation point in the server or the next set of results should be returned. Clients should always call this Service even if they do not want to continue querying. In this case this flag is set to true.
[in,out]continuationPointContinuation point returned from a previous queryFirst or queryNext call. A continuation point is returned when the server was not able to deliver all results in the query response. The limitation can be set by the client in the queryFirst or by the server during query processing. The continuation point can be passed to queryNext to get the remaining results.
[out]queryDataSetsList of query data results.
UaStatus UaSession::read ( ServiceSettings serviceSettings,
OpcUa_Double  maxAge,
OpcUa_TimestampsToReturn  timeStamps,
const UaReadValueIds nodesToRead,
UaDataValues values,
UaDiagnosticInfos &  diagnosticInfos 
)

Reads Attribute values synchronously from an OPC UA server.

The Read Service is used to read one or more Attributes of one or more Nodes. It also allows reading subsets or single elements of array values and to define a valid age of values to be returned to reduce the need for device reads. Like most other Services, the Read is optimized for bulk read operations and not for reading single Attribute values. Typically all Node Attributes are readable. For the Value Attribute, the Read rights are indicated by the AccessLevel and UserAccessLevel Attribute of the Variable.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]maxAgeThe maximum age of the value to be read in milliseconds. This parameter allows clients to reduce the communication between server and data source by allowing the server to return a cached value that is not older than the defined time period. Setting a value of 0 forces the server to obtain the current value. This is similar to a device read in Classic OPC.
[in]timeStampsOPC UA defines two timestamps, the source and the server timestamp. This parameter allows the client to define which timestamps the server should return with the value.

The source timestamp is only available for Value Attributes. The source timestamp is used to reflect the timestamp that was applied to a Variable value by the data source. It should indicate the last change of the value or status code. The source timestamp must always be generated by the same physical clock. This timestamp type was added for OPC UA to cover the use case to get the timestamp of the last value change which differs from the server timestamp definition.

The server timestamp is used to reflect the time that the server received a Variable value or knew it to be accurate if the changes are reported by exception and the connection to the data source is operating. This is the behavior expected by Classic OPC.

Possible values are:
  • OpcUa_TimestampsToReturn_Source
  • OpcUa_TimestampsToReturn_Server
  • OpcUa_TimestampsToReturn_Both
[in]nodesToReadList of Nodes and Attributes to read identified by an array of OpcUa_ReadValueId structures.

The ReadValueId consist of
  • NodeId: NodeId of the node to read
  • AttributeId: Id of the attribute to read for example OpcUa_Attributes_Value
  • IndexRange: Option to request subsets of array or matrix values

    The IndexRange parameter is used to select a single element of an array, or a single range of indexes for arrays based on a string syntax called NumericRange. The first element is identified by index 0 (zero).
    A single element is selected with an individual integer, for example "6". A single range is represented by two integers separated by the colon (':') character, for example, "5:7".
    Multi-dimensional arrays can be indexed by specifying a range for each dimension separated by a ','. For example, a 2x2 block in a 4x4 matrix could be selected with the range "1:2,0:1". A single element in a multi-dimensional array can be selected by specifying a single number instead of a range. For example, "1,1" specifies selects the [1,1] element in a two dimensional array.

    The following BNF describes the syntax
    <numeric-range> ::= <dimension> [',' <dimension>]
    <dimension> ::= <index> [':' <index>]
    <index> ::= <digit> [<digit>]
    <digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
[out]valuesList of read results contained in an array of OpcUa_DataValue structures.

The DataValue consist of
  • Value: The value of the read node and attribute combination
  • StatusCode: This parameter is used to indicate the conditions under which the value was generated, and thereby can be used as an indicator of the usability of the value.
  • SourceTimestamp: Reflects the UTC timestamp that was applied to the value by the data source. It is only available for Value attributes.
  • ServerTimestamp: Reflects the time that the Server received the value or knew it to be accurate.
[out]diagnosticInfosList of diagnostic information.
UaStatus UaSession::registerNodes ( ServiceSettings serviceSettings,
const UaNodeIdArray nodesToRegister,
UaNodeIdArray registeredNodesIds 
)

Register nodes to create shortcuts in the server.

This method allows clients to optimize the cyclic access to Nodes for example for writing variable values or for calling methods. There are two levels of optimization.

The first level is to reduce the amount of data on the wire for the addressing information. Since NodeIds are used for addressing in Nodes and NodeIds can be very long, a more optimized addressing method is desirable for cyclic use of Nodes. Classic OPC provided the concept to create handles for items by adding them to a group. RegisterNodes provides a similar concept to create handles for Nodes by returning a numeric NodeId that can be used in all functions accessing information from the server. The transport of numeric NodeIds is very efficient in the OPC UA binary protocol.

The second level of optimization is possible inside the server. Since the client is telling the server that it wants to use the Node more frequently by registering the Node, the server is able to prepare everything that is possible to optimize the access to the Node.

The handles returned by the server are only valid during the lifetime of the Session that was used to register the Nodes. Clients must call unregisterNodes if the Node is no longer used to free the resources used in the server for the optimization. This method should not be used to optimize the cyclic read of data since OPC UA provides a much more optimized mechanism to subscribe for data changes.

Clients do not have to use the Service and servers can simply implement the Service only returning the same list of NodeIds that was passed in if there is no need to optimize the access.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]nodesToRegisterThe list of Nodes to register. For each Node the NodeId of the Node is passed in.
[out]registeredNodesIdsList of NodeIds identifying the registered Node. This NodeId is typically an optimized numeric Node used as handle to the registered Node. This NodeId is only valid in the Session context it was created in.

If the server does not know the NodeId or is not able to optimize the access to the Node, it simply returns the NodeId provided in the request.
UaByteString UaSession::serverCertificate ( ) const

Provides the certificate of the UA server.

If the connection is a non-secure connection, this property might be empty.

OpcUa_ServerState UaSession::serverState ( ) const

Provides the current server state of the OPC UA server.

This enumeration value is read from the server through the status reads or is OpcUa_ServerState_Unknown if the server is not connected.

The enumeration has the following possible values:

OpcUa_ServerState_Running
The server is running normally. This is the usual state for a server.
OpcUa_ServerState_Failed
A vendor-specific fatal error has occurred within the server. The server is no longer functioning. The recovery procedure from this situation is vendor-specific. Most Service requests should be expected to fail.
OpcUa_ServerState_NoConfiguration
The server is running but has no configuration information loaded and therefore does not transfer data.
OpcUa_ServerState_Shutdown
The server has shut down or is in the process of shutting down. Depending on the implementation, this might or might not be visible to clients.
OpcUa_ServerState_Test
The server is in Test Mode. The outputs are disconnected from the real hardware, but the server will otherwise behave normally. Inputs may be real or may be simulated depending on the vendor implementation. StatusCode will generally be returned normally.
OpcUa_ServerState_CommunicationFault
The server is running properly, but is having difficulty accessing data from its data sources. This may be due to communication problems or some other problem preventing the underlying device, control system etc., from returning valid data. It may be a complete failure, meaning that no data is available, or a partial failure, meaning that some data is still available. It is expected that items affected by the fault will individually return with a BAD FAILURE status code indication for the items.
OpcUa_ServerState_Unknown
This state is used only to indicate that the OPC UA server does not know the state of underlying servers.
UaClient::ServerStatus UaSession::serverStatus ( ) const

Provides the actual connection status to the OPC UA server.

The enumeration has the following possible values:

Disconnected
The connection to the server is deactivated by the user of the client API.
Connected
The connection to the server is established and is working in normal mode.
ConnectionWarningWatchdogTimeout
The monitoring of the connection to the server indicated a potential connection problem.
ConnectionErrorApiReconnect
The monitoring of the connection to the server detected an error and is trying to reconnect to the server.
ServerShutdown
The server sent a shutdown event and the client API tries a reconnect.
UaNodeId UaSession::sessionId ( ) const

Provides the sessionId for this connection to the UA server.

The sessionId is a nodeId in the server address space that is assigned by the server during connect and uniquely identifies the session on the server. In most cases you won't be interested in the sessionId and you can ignore this property.

UaStatus UaSession::transferSubscription ( ServiceSettings serviceSettings,
UaSubscriptionCallback pUaSubscriptionCallback,
OpcUa_UInt32  clientSubscriptionHandle,
OpcUa_UInt32  subscriptionId,
SubscriptionSettings subscriptionSettings,
OpcUa_Boolean  publishingEnabled,
OpcUa_Boolean  sendInitialValues,
UaSubscription **  ppUaSubscription,
UaUInt32Array availableSequenceNumbers 
)

Transfers a subscription from another client to this session.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]pUaSubscriptionCallbackCallback interface for the subscription used to send data changes, events, and subscription status changes to the client application.
[in]clientSubscriptionHandleClient defined handle for the subscription. This handle is used to identify the subscription in the callback methods.
[in]subscriptionIdSubscription identifier of the subscription to transfer to this session.
[in]subscriptionSettingsSubscription settings reflecting the current setting on the server. This is used to initialize the client side subscription object.
[in]publishingEnabledPublishing enabled settings reflecting the current setting on the server. This is used to initialize the client side subscription object.
[in]sendInitialValuesFlag indicating if the first Publish response after the TransferSubscriptions call should contain the current values of all Monitored Items in the Subscription where the Monitoring Mode is set to Reporting.
[out]ppUaSubscriptionClient side subscription created by the session object. This object must be passed to deleteSubscription to clean up resources even if the subscription is already deleted on the server.
[out]availableSequenceNumbersAvailable sequence numbers in the queue of sent and not confirmed publish responses.
UaStatus UaSession::translateBrowsePathsToNodeIds ( ServiceSettings serviceSettings,
const UaBrowsePaths browsePaths,
UaBrowsePathResults browsePathResults,
UaDiagnosticInfos &  diagnosticInfos 
)

Translate a browse path to a NodeId.

This Service is used to access components of an Object based on the knowledge about the ObjectType. Since the NodeId of a Node is needed to access information provided by the Node, like subscribing for Variable Value changes or to call a Method, it is necessary to know the NodeIds of components of Objects. Since OPC UA allows programming software components with built-in knowledge of ObjectTypes, UA needs to provide a mechanism to return the NodeIds for components of an Object instance based on the knowledge about the ObjectType. This mechanism is built on the requirement that the BrowseNames of components of the instance must be the same like BrowseNames of components of the type.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]browsePathsThe list of browse paths for which NodeIds are requested.
[out]browsePathResultsList of results for the passed starting Nodes and paths.
[out]diagnosticInfosList of diagnostic information.
UaStatus UaSession::unregisterNodes ( ServiceSettings serviceSettings,
const UaNodeIdArray registeredNodesIds 
)

Unregister nodes to delete shortcuts in the server.

Handles created with the Service RegisterNodes must be freed by the client using the method unregisterNodes to free the resources in the server if the registered nodes are no longer needed.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]registeredNodesIdsThe list of Nodes to unregister.
bool UaSession::verificationError ( SessionSecurityInfo pInfo,
OpcUa_Void *  pvVerifyContext,
const UaByteString certificateChain,
OpcUa_StatusCode  uVerificationResult,
OpcUa_UInt32  uDepth 
)
protectedvirtual

Callback method to inform about errors during certificate validation.

Returns
true if a certificate validation error should be ignored, false otherwise. If an error is ignored, validation continues, otherwise verification will be stopped.

Implements UaClientSdk::CertificateValidationCallback.

UaStatus UaSession::write ( ServiceSettings serviceSettings,
const UaWriteValues nodesToWrite,
UaStatusCodeArray results,
UaDiagnosticInfos &  diagnosticInfos 
)

Writes variable values synchronously to an OPC UA server.

Parameters
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details.
[in]nodesToWriteList of Nodes, Attributes and the values to write identified by an array of OpcUa_WriteValue structures

The WriteValue consist of
  • NodeId: NodeId of the node to write
  • AttributeId: Id of the attribute to write for example OpcUa_Attributes_Value
  • IndexRange: Option to write subsets of array or matrix values
  • Value: The value to write

    The IndexRange parameter is used to select a single element of an array, or a single range of indexes for arrays based on a string syntax called NumericRange. The first element is identified by index 0 (zero).
    A single element is selected with an individual integer, for example "6". A single range is represented by two integers separated by the colon (':') character, for example, "5:7".
    Multi-dimensional arrays can be indexed by specifying a range for each dimension separated by a ','. For example, a 2x2 block in a 4x4 matrix could be selected with the range "1:2,0:1". A single element in a multi-dimensional array can be selected by specifying a single number instead of a range. For example, "1,1" specifies selects the [1,1] element in a two dimensional array.
    The size of the array in the Value parameter shall match the size specified by the IndexRange.

    The following BNF describes the syntax
    <numeric-range> ::= <dimension> [',' <dimension>]
    <dimension> ::= <index> [':' <index>]
    <index> ::= <digit> [<digit>]
    <digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
[out]resultsList of write results
[out]diagnosticInfosList of diagnostic information

The documentation for this class was generated from the following files: