#include <uasession.h>
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 ®isteredNodesIds) |
UaStatus | unregisterNodes (ServiceSettings &serviceSettings, const UaNodeIdArray ®isteredNodesIds) |
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 |
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.
UaSession::UaSession | ( | ) |
Construction
UaSession::~UaSession | ( | ) |
Destruction
UaStatus UaSession::addNodes | ( | ServiceSettings & | serviceSettings, |
const UaAddNodesItems & | nodesToAdd, | ||
UaAddNodesResults & | results, | ||
UaDiagnosticInfos & | diagnosticInfos | ||
) |
Adds a list of nodes to the OPC server address space
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | nodesToAdd | List of nodes to add to the server |
[out] | results | List of the add node results |
[out] | diagnosticInfos | List 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
[in,out] | serviceSettings | The 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
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | nodesToAdd | List of nodes to add to the server |
[in] | transactionId | Transaction 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
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | referencesToAdd | List of references to add to the server |
[in] | transactionId | Transaction 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
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | callRequest | Object and Method to call and input arguments. See CallIn for more details |
[out] | transactionId | Output 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
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | nodesToDelete | List of nodes to delete from the server address space |
[in] | transactionId | Transaction 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
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | referencesToDelete | List of references to delete from the server address space |
[in] | transactionId | Transaction 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
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | maxAge | Max age of the values to return. See read for more details |
[in] | timeStamps | Type of timestamps to return. See read for more details |
[in] | nodesToRead | List of Nodes and Attributes to read |
[in] | transactionId | Transaction 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
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | nodesToWrite | List of Nodes, Attributes and the values to write |
[in] | transactionId | Transaction 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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | nodeToBrowse | NodeId of the starting Node |
[in] | browseContext | Filter settings for the browse call. See BrowseContext for more details |
[out] | continuationPoint | A 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] | referenceDescriptions | List 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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | releaseContinuationPoint | A 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] | continuationPoints | Continuation 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] | browseResults | List browse results containing references and target Node information for the Nodes passing the filter criteria set in the first browse call |
[out] | diagnosticInfos | List 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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | releaseContinuationPoint | A 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] | continuationPoint | Continuation 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] | referenceDescriptions | List 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
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | callRequest | Object and Method to call and input arguments. See CallIn for more details |
[out] | callResponse | Output 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
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | callMethodRequests | List of Objects and Methods to call including input arguments. |
[out] | callMethodResults | List of output arguments and input argument results for each requested method call. |
[out] | diagnosticInfos | List 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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | pUserIdentityToken | The 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
[in] | sURL | The URL identifying an OPC UA Server. UA TCP: opc.tcp://MACHINE:4840 Web Service: https://MACHINE/ServerName |
[in,out] | sessionConnectInfo | The client defined session connect settings. See SessionConnectInfo for more info. |
[in,out] | sessionSecurityInfo | The client defined session security settings. See SessionSecurityInfo for more info. |
[in] | pSessionCallback | Pointer 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
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | pUaSubscriptionCallback | Callback interface for the subscription used to send data changes, events and subscription status chances to the client application |
[in] | clientSubscriptionHandle | Client defined handle for the subscription. This handle is used to identify the subscription in the callback methods |
[in,out] | subscriptionSettings | Requesteda and revised subscription settings like publish interval and keep alive counter |
[in] | publishingEnabled | Flag indicating if publishing is enabled or disabled |
[out] | ppUaSubscription | Client 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
[in,out] | serviceSettings | The 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
[in,out] | serviceSettings | The 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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in,out] | ppUaSubscription | The 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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | bDeleteSubscriptions | Flag 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
[in,out] | serviceSettings | The 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
[in,out] | serviceSettings | The 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
[in,out] | serviceSettings | The 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_TotalizeAverage | Returns 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_MinimumActualTime | Returns the minimum value in the resample interval and the timestamp of the minimum value |
OpcUaId_AggregateFunction_MaximumActualTime | Returns 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_AnnotationCount | Returns 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_DurationInState0 | The duration of the interval the value was in FALSE state. The value of the aggregate is the time in milliseconds |
OpcUaId_AggregateFunction_DurationInState1 | The duration of the interval the value was in TRUE state. The value of the aggregate is the time in milliseconds |
OpcUaId_AggregateFunction_NumberOfTransitions | Returns 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 |
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | historyReadProcessedContext | The read processed specific settings for the method call. See HistoryReadProcessedContext for more details |
[out] | nodesToRead | The list of nodes to read. |
[out] | results | The 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
[in,out] | serviceSettings | The 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
[in,out] | serviceSettings | The 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.
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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | maxAge | The 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] | timeStamps | OPC 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] | nodesToRead | List of Nodes and Attributes to read |
[out] | values | List of read results contained in OpcUa_DataValue structures |
[out] | diagnosticInfos | List 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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | nodesToRegister | The list of Nodes to register. For each Node the NodeId of the Node is passed in |
[out] | registeredNodesIds | List 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:
UaClient::ServerStatus UaSession::serverStatus | ( | ) | const |
Provides the actual connection status to the UA server.
The enumeration has the following possible values:
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
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | pUaSubscriptionCallback | Callback interface for the subscription used to send data changes, events and subscription status chances to the client application. |
[in] | clientSubscriptionHandle | Client defined handle for the subscription. This handle is used to identify the subscription in the callback methods |
[in] | subscriptionId | Subscription identifier of the subscription to transfer to this session |
[in] | subscriptionSettings | Subscription settings reflecting the current setting in the server. This is used to initialize the client side subscription object. |
[in] | publishingEnabled | Publishing enabled settings reflecting the current setting in the server. This is used to initialize the client side subscription object. |
[in] | sendInitialValues | Flag 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] | ppUaSubscription | Client 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] | availableSequenceNumbers | Available 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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | browsePaths | The list of browse paths for which NodeIds are requested |
[out] | browsePathResults | List of results for the passed starting Nodes and paths |
[out] | diagnosticInfos | List 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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | registeredNodesIds | The list of Nodes to unregister |
UaStatus UaSession::write | ( | ServiceSettings & | serviceSettings, |
const UaWriteValues & | nodesToWrite, | ||
UaStatusCodeArray & | results, | ||
UaDiagnosticInfos & | diagnosticInfos | ||
) |
Writes variable values synchronous to OPC server
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details |
[in] | nodesToWrite | List of Nodes, Attributes and the values to write |
[out] | results | List of write results |
[out] | diagnosticInfos | List of diagnostic information |