UaClientSdk::UaSession Class Reference
[UA Client Library]

#include <uasession.h>

List of all members.

Public Member Functions

 UaSession ()
 ~UaSession ()
UaStatus connect (const UaString &sURL, SessionConnectInfo &sessionConnectInfo, SessionSecurityInfo &sessionSecurityInfo, UaSessionCallback *pSessionCallback)
UaStatus disconnect (ServiceSettings &serviceSettings, OpcUa_Boolean bDeleteSubscriptions)
UaStatus changeUser (ServiceSettings &serviceSettings, UaUserIdentityToken *pUserIdentityToken)
UaStatus browse (ServiceSettings &serviceSettings, const UaNodeId &nodeToBrowse, const BrowseContext &browseContext, UaByteString &continuationPoint, UaReferenceDescriptions &referenceDescriptions)
UaStatus browseNext (ServiceSettings &serviceSettings, OpcUa_Boolean releaseContinuationPoint, UaByteString &continuationPoint, UaReferenceDescriptions &referenceDescriptions)
UaStatus browseList (ServiceSettings &serviceSettings, const OpcUa_ViewDescription &viewDescription, OpcUa_UInt32 maxReferencesToReturn, const UaBrowseDescriptions &browseDescription, UaBrowseResults &browseResults, UaDiagnosticInfos &diagnosticInfos)
UaStatus browseListNext (ServiceSettings &serviceSettings, OpcUa_Boolean releaseContinuationPoint, const UaByteStringArray &continuationPoints, UaBrowseResults &browseResults, UaDiagnosticInfos &diagnosticInfos)
UaStatus translateBrowsePathsToNodeIds (ServiceSettings &serviceSettings, const UaBrowsePaths &browsePaths, UaBrowsePathResults &browsePathResults, UaDiagnosticInfos &diagnosticInfos)
UaStatus registerNodes (ServiceSettings &serviceSettings, const UaNodeIdArray &nodesToRegister, UaNodeIdArray &registeredNodesIds)
UaStatus unregisterNodes (ServiceSettings &serviceSettings, const UaNodeIdArray &registeredNodesIds)
UaStatus read (ServiceSettings &serviceSettings, OpcUa_Double maxAge, OpcUa_TimestampsToReturn timeStamps, const UaReadValueIds &nodesToRead, UaDataValues &values, UaDiagnosticInfos &diagnosticInfos)
UaStatus beginRead (ServiceSettings &serviceSettings, OpcUa_Double maxAge, OpcUa_TimestampsToReturn timeStamps, const UaReadValueIds &nodesToRead, OpcUa_UInt32 transactionId)
UaStatus write (ServiceSettings &serviceSettings, const UaWriteValues &nodesToWrite, UaStatusCodeArray &results, UaDiagnosticInfos &diagnosticInfos)
UaStatus beginWrite (ServiceSettings &serviceSettings, const UaWriteValues &nodesToWrite, OpcUa_UInt32 transactionId)
UaStatus createSubscription (ServiceSettings &serviceSettings, UaSubscriptionCallback *pUaSubscriptionCallback, OpcUa_UInt32 clientSubscriptionHandle, SubscriptionSettings &subscriptionSettings, OpcUa_Boolean publishingEnabled, UaSubscription **ppUaSubscription)
UaStatus deleteSubscription (ServiceSettings &serviceSettings, UaSubscription **ppUaSubscription)
UaStatus transferSubscription (ServiceSettings &serviceSettings, UaSubscriptionCallback *pUaSubscriptionCallback, OpcUa_UInt32 clientSubscriptionHandle, OpcUa_UInt32 subscriptionId, SubscriptionSettings &subscriptionSettings, OpcUa_Boolean publishingEnabled, OpcUa_Boolean sendInitialValues, UaSubscription **ppUaSubscription, UaUInt32Array &availableSequenceNumbers)
UaStatus call (ServiceSettings &serviceSettings, const CallIn &callRequest, CallOut &results)
UaStatus beginCall (ServiceSettings &serviceSettings, const CallIn &callRequest, OpcUa_UInt32 transactionId)
UaStatus callList (ServiceSettings &serviceSettings, const UaCallMethodRequests &callMethodRequests, UaCallMethodResults &callMethodResults, UaDiagnosticInfos &diagnosticInfos)
UaStatus historyReadRawModified (ServiceSettings &serviceSettings, const HistoryReadRawModifiedContext &historyReadRawModifiedContext, const UaHistoryReadValueIds &nodesToRead, HistoryReadDataResults &results)
UaStatus historyReadProcessed (ServiceSettings &serviceSettings, const HistoryReadProcessedContext &historyReadProcessedContext, const UaHistoryReadValueIds &nodesToRead, HistoryReadDataResults &results)
UaStatus historyReadAtTime (ServiceSettings &serviceSettings, const HistoryReadAtTimeContext &historyReadAtTimeContext, const UaHistoryReadValueIds &nodesToRead, HistoryReadDataResults &results)
UaStatus historyUpdateData (ServiceSettings &serviceSettings, const UpdateDataDetails &updateDataDetails, UaHistoryUpdateResults &results, UaDiagnosticInfos &diagnosticInfos)
UaStatus historyDeleteRawModified (ServiceSettings &serviceSettings, const DeleteRawModifiedDetails &deleteDetails, UaHistoryUpdateResults &results, UaDiagnosticInfos &diagnosticInfos)
UaStatus historyDeleteAtTime (ServiceSettings &serviceSettings, const DeleteAtTimeDetails &deleteDetails, UaHistoryUpdateResults &results, UaDiagnosticInfos &diagnosticInfos)
UaStatus addNodes (ServiceSettings &serviceSettings, const UaAddNodesItems &nodesToAdd, UaAddNodesResults &results, UaDiagnosticInfos &diagnosticInfos)
UaStatus addReferences (ServiceSettings &serviceSettings, const UaAddReferencesItems &referencesToAdd, UaStatusCodeArray &results, UaDiagnosticInfos &diagnosticInfos)
UaStatus deleteNodes (ServiceSettings &serviceSettings, const UaDeleteNodesItems &nodesToDelete, UaStatusCodeArray &results, UaDiagnosticInfos &diagnosticInfos)
UaStatus deleteReferences (ServiceSettings &serviceSettings, const UaDeleteReferencesItems &referencesToDelete, UaStatusCodeArray &results, UaDiagnosticInfos &diagnosticInfos)
UaStatus beginAddNodes (ServiceSettings &serviceSettings, const UaAddNodesItems &nodesToAdd, OpcUa_UInt32 transactionId)
UaStatus beginAddReferences (ServiceSettings &serviceSettings, const UaAddReferencesItems &referencesToAdd, OpcUa_UInt32 transactionId)
UaStatus beginDeleteNodes (ServiceSettings &serviceSettings, const UaDeleteNodesItems &nodesToDelete, OpcUa_UInt32 transactionId)
UaStatus beginDeleteReferences (ServiceSettings &serviceSettings, const UaDeleteReferencesItems &referencesToDelete, OpcUa_UInt32 transactionId)
OpcUa_Boolean isConnected () const
UaClient::ServerStatus serverStatus () const
OpcUa_ServerState serverState () const

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 none Subscription related UA Services as synchronous and asynchronous methods.


Constructor & Destructor Documentation

UaSession::UaSession (  )

Construction

UaSession::~UaSession (  )

Destruction


Member Function Documentation

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

Adds a list of nodes to the OPC 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 server address space

Parameters:
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]referencesToAdd
[out]results
[out]diagnosticInfos
UaStatus UaSession::beginAddNodes ( ServiceSettings serviceSettings,
const UaAddNodesItems &  nodesToAdd,
OpcUa_UInt32  transactionId 
)

Adds a list of nodes asynchronous to the OPC 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 asynchronous to the OPC 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 in the OPC 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 asynchronous from the OPC 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 asynchronous from the OPC 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::beginRead ( ServiceSettings serviceSettings,
OpcUa_Double  maxAge,
OpcUa_TimestampsToReturn  timeStamps,
const UaReadValueIds &  nodesToRead,
OpcUa_UInt32  transactionId 
)

Reads attribute values asynchronous from OPC server See read for more details

Parameters:
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]maxAgeMax 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 asynchronous to OPC 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
[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 server address space with one 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 simpliefied 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 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 if the method is called only for releasing the memory associated with the continuation point in the server or if 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 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 if the method is called only for releasing the memory associated with the continuation point in the server or if 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 in the OPC 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 in the OPC 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::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 UaUserIdentityTokenAnonymous for the user type Anonymous and UaUserIdentityTokenUserPassword for the user type UserPassword
UaStatus UaSession::connect ( const UaString sURL,
SessionConnectInfo sessionConnectInfo,
SessionSecurityInfo sessionSecurityInfo,
UaSessionCallback pSessionCallback 
)

Establish a connection to the OPC UA server Calling this function sucessfully 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 frequence 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
    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.
UA TCP: opc.tcp://MACHINE:4840
Web Service: https://MACHINE/ServerName
[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 chances to the client application
[in]clientSubscriptionHandleClient defined handle for the subscription. This handle is used to identify the subscription in the callback methods
[in,out]subscriptionSettingsRequesteda and revised subscription settings like publish interval and keep alive counter
[in]publishingEnabledFlag indicating if 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.
UaStatus UaSession::deleteNodes ( ServiceSettings serviceSettings,
const UaDeleteNodesItems &  nodesToDelete,
UaStatusCodeArray &  results,
UaDiagnosticInfos &  diagnosticInfos 
)

Removes a list of nodes from the OPC server address space

Parameters:
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]nodesToDelete
[out]results
[out]diagnosticInfos
UaStatus UaSession::deleteReferences ( ServiceSettings serviceSettings,
const UaDeleteReferencesItems &  referencesToDelete,
UaStatusCodeArray &  results,
UaDiagnosticInfos &  diagnosticInfos 
)

Removes a list of references from the OPC 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 
)

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

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
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 the session are also deleted if the flag bDeleteSubscriptions is set to OpcUa_True. If subscritptions should be transfered to other sessions, the flag bDeleteSubscriptions must be set to OpcUa_False.

Parameters:
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]bDeleteSubscriptionsFlag to indicate if all subscriptions assigned to the session should be deleted
UaStatus UaSession::historyDeleteAtTime ( ServiceSettings serviceSettings,
const DeleteAtTimeDetails deleteDetails,
UaHistoryUpdateResults &  results,
UaDiagnosticInfos &  diagnosticInfos 
)

Delete the history of item values synchronous at OPC server for the given timestamps

Parameters:
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]deleteDetails
[out]results
[out]diagnosticInfos
UaStatus UaSession::historyDeleteRawModified ( ServiceSettings serviceSettings,
const DeleteRawModifiedDetails deleteDetails,
UaHistoryUpdateResults &  results,
UaDiagnosticInfos &  diagnosticInfos 
)

Delete the history of item values synchronous at OPC server

Parameters:
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]deleteDetails
[out]results
[out]diagnosticInfos
UaStatus UaSession::historyReadAtTime ( ServiceSettings serviceSettings,
const HistoryReadAtTimeContext historyReadAtTimeContext,
const UaHistoryReadValueIds &  nodesToRead,
HistoryReadDataResults results 
)

Reads the history of item values synchronous from OPC server for the given timestamps

Parameters:
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]historyReadAtTimeContext
[in]nodesToRead
[out]results
UaStatus UaSession::historyReadProcessed ( ServiceSettings serviceSettings,
const HistoryReadProcessedContext historyReadProcessedContext,
const UaHistoryReadValueIds &  nodesToRead,
HistoryReadDataResults results 
)

Reads the processed history of item values synchronous from the OPC 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. The returned number can be limited by the client or the server. 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 Returns an interpolated value for the starting time of the 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_Total Returns the sum of the data over the resample interval. It adds up all values in the interval
OpcUaId_AggregateFunction_TotalizeAverageReturns the totalized Value (time integral) of the data over the resample interval
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 Returns the difference between the minimum and maximum Value over the sample 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_DurationInState0The duration of the interval the value was in FALSE state. The value of the aggregate is the time in milliseconds
OpcUaId_AggregateFunction_DurationInState1The duration of the interval the value was in TRUE state. The value of the aggregate is the time in milliseconds
OpcUaId_AggregateFunction_NumberOfTransitionsReturns the number of value changes with good quality in the resample interval
OpcUaId_AggregateFunction_Time
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 Returns the worst quality of the values in the interval. The value of the aggregate is the status code for the worst quality
Parameters:
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]historyReadProcessedContextThe read processed specific settings for the method call. See HistoryReadProcessedContext for more details
[out]nodesToReadThe list of nodes to read.
[out]resultsThe list of read results.
UaStatus UaSession::historyReadRawModified ( ServiceSettings serviceSettings,
const HistoryReadRawModifiedContext historyReadRawModifiedContext,
const UaHistoryReadValueIds &  nodesToRead,
HistoryReadDataResults results 
)

Reads the history of item values synchronous from OPC server

Parameters:
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]historyReadRawModifiedContext
[in]nodesToRead
[out]results
UaStatus UaSession::historyUpdateData ( ServiceSettings serviceSettings,
const UpdateDataDetails updateDataDetails,
UaHistoryUpdateResults &  results,
UaDiagnosticInfos &  diagnosticInfos 
)

Update the history of item values synchronous at OPC server

Parameters:
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]updateDataDetails
[out]results
[out]diagnosticInfos
OpcUa_Boolean UaSession::isConnected (  ) const

Flag that indicates if the UaSession is connected. This flag does not reflect the actuall server status indicating the real connection status to the server.

See also:
serverStatus. 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.
UaStatus UaSession::read ( ServiceSettings serviceSettings,
OpcUa_Double  maxAge,
OpcUa_TimestampsToReturn  timeStamps,
const UaReadValueIds &  nodesToRead,
UaDataValues &  values,
UaDiagnosticInfos &  diagnosticInfos 
)

Reads attribute values synchronous from OPC server The Read Service is used to read one or more Attributes of one or more Nodes. It allows also 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 be always 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 is different than 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 exeption 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
[out]valuesList of read results contained in OpcUa_DataValue structures
[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 he 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 he is not able to optimize the access to the Node, he simply returns the NodeId provided in the request
OpcUa_ServerState UaSession::serverState (  ) const

Provides the actual server state of the 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_Suspended - The server has been temporarily suspended by some vendor-specific method and is not receiving or sending 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 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
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 
)

Transfer 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 chances 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 in the server. This is used to initialize the client side subscription object.
[in]publishingEnabledPublishing enabled settings reflecting the current setting in 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 in 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 in the instance must be the same like BrowseNames of components in 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 not longer needed.

Parameters:
[in,out]serviceSettingsThe general service settings like timeout. See ServiceSettings for more details
[in]registeredNodesIdsThe list of Nodes to unregister
UaStatus UaSession::write ( ServiceSettings serviceSettings,
const UaWriteValues &  nodesToWrite,
UaStatusCodeArray &  results,
UaDiagnosticInfos &  diagnosticInfos 
)

Writes variable values synchronous to OPC 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
[out]resultsList of write results
[out]diagnosticInfosList of diagnostic information

The documentation for this class was generated from the following files:
  • /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uasession.h
  • /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uasession.cpp