C++ UA Server SDK  1.5.0.318
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages

Interface definition of the IOManager used for reading, writing and monitoring data. More...

#include <iomanager.h>

Inherited by IOManagerUaNode.

Public Types

enum  TransactionType {
  TransactionRead, TransactionWrite, TransactionMonitorBegin, TransactionMonitorModify,
  TransactionMonitorStop, TransactionInvalid
}
 TransactionType enumeration. More...
 

Public Member Functions

 IOManager ()
 Construction.
 
virtual ~IOManager ()
 Destruction.
 
virtual UaStatus beginTransaction (IOManagerCallback *pCallback, const ServiceContext &serviceContext, OpcUa_UInt32 hTransaction, OpcUa_UInt32 totalItemCountHint, OpcUa_Double maxAge, OpcUa_TimestampsToReturn timestampsToReturn, TransactionType transactionType, OpcUa_Handle &hIOManagerContext)=0
 Begin a IOManager transaction. More...
 
virtual UaStatus beginStartMonitoring (OpcUa_Handle hIOManagerContext, OpcUa_UInt32 callbackHandle, IOVariableCallback *pIOVariableCallback, VariableHandle *pVariableHandle, MonitoringContext &monitoringContext)=0
 Begin start monitoring of an item. More...
 
virtual UaStatus beginModifyMonitoring (OpcUa_Handle hIOManagerContext, OpcUa_UInt32 callbackHandle, OpcUa_UInt32 hIOVariable, MonitoringContext &monitoringContext)=0
 Begin modify monitoring of an item. More...
 
virtual UaStatus beginStopMonitoring (OpcUa_Handle hIOManagerContext, OpcUa_UInt32 callbackHandle, OpcUa_UInt32 hIOVariable)=0
 Begin stop monitoring of an item. More...
 
virtual UaStatus beginRead (OpcUa_Handle hIOManagerContext, OpcUa_UInt32 callbackHandle, VariableHandle *pVariableHandle, OpcUa_ReadValueId *pReadValueId)=0
 Begin reading an attribute value of a node. More...
 
virtual UaStatus beginWrite (OpcUa_Handle hIOManagerContext, OpcUa_UInt32 callbackHandle, VariableHandle *pVariableHandle, OpcUa_WriteValue *pWriteValue)=0
 Begin writing an attribute value for a node. More...
 
virtual UaStatus finishTransaction (OpcUa_Handle hIOManagerContext)=0
 Finish a transaction. More...
 

Detailed Description

Interface definition of the IOManager used for reading, writing and monitoring data.

The IOManager interface provides the reading, writing and monitoring capabilities for node attributes. The IOManager interface is asynchronous. For the IOManager callback the IOManagerCallback interface is implemented by the consumer of the attribute data. One of the consumers is the UA Module. This interface is used by the SDK to multiplex the list of nodes in the UA service call to different IOManagers. One UA service call is a transaction for the SDK. If an IOManager is used in a transaction, the beginTransaction method is called by the SDK. This allows the IOManager to create a context for the transactions since the SDK will call the associated begin method (e.g. beginRead for the UA Read service) for each node in the transaction. Depending on the underlying system, the action can be started for each node in the begin method or for a list of nodes in the finishTransaction method. If the underlying system allows optimizing access for a list of nodes, the finishTransaction method should be used to start the access to the underlying system. This method is called by the SDK after calling the begin methods for all nodes in the transaction.

Member Function Documentation

virtual UaStatus IOManager::beginModifyMonitoring ( OpcUa_Handle  hIOManagerContext,
OpcUa_UInt32  callbackHandle,
OpcUa_UInt32  hIOVariable,
MonitoringContext monitoringContext 
)
pure virtual

Begin modify monitoring of an item.

Is called by the SDK for each node in a UA ModifyMonitoredItems service call. It is expected that this method does not block for external communication with the underlying system. See also beginRead description for more details. The corresponding callback method is the finishModifyMonitoring method.

Parameters
hIOManagerContextIOManager handle for the transaction context. This handle is used to identify the transaction in the IOManager.
callbackHandleHandle for the node in the callback.
hIOVariableThe handle of the variable in the IOManager created with beginStartMonitoring. The handle was passed to the SDK in the callback finishStartMonitoring.
monitoringContextObject containing the requested settings for the monitored item like sampling interval or deadband. The object is only valid during this method is called
Returns
Error code

Implemented in IOManagerUaNode.

virtual UaStatus IOManager::beginRead ( OpcUa_Handle  hIOManagerContext,
OpcUa_UInt32  callbackHandle,
VariableHandle pVariableHandle,
OpcUa_ReadValueId pReadValueId 
)
pure virtual

Begin reading an attribute value of a node.

Is called by the SDK for each node in a UA Read service call. It is expected that this method does not block for external communication with the underlying system. If the read can be done inside the local process memory, the read can be executed and the finishRead method can be called inside this method call. If the underlying system is able to queue the read for the node without blocking for external communication, the beginRead can queue the node in the underlying system. If the communication with the underlying system can block, the node must be stored in the context of the transaction and the communication with the underlying system must be started asynchronous in the finishTransaction method. The corresponding callback method is the finishRead method. The in parameters are valid until the last finishRead method is called for the transaction.

Parameters
hIOManagerContextIOManager handle for the transaction context. This handle is used to identify the transaction in the IOManager.
callbackHandleHandle for the node in the callback.
pVariableHandleVariable handle provided by the NodeManager::getVariableHandle. This object contains the information needed by the IOManager to identify the node to read in its context. The object is reference counted. The reference used by the SDK is released after finishTransaction is called. If the IOManager needs the VariableHandle of asynchronous handling, the IOManager must add its own reference as long as the VariableHandle is used.
pReadValueIdContext for the node to read. The context contains the IndexRange and the DataEncoding requested by the client. The other parameters of this context are already handled by the VariableHandle. The read context pointer is valid until the transaction is completely finished.
Returns
Error code

Implemented in IOManagerUaNode.

virtual UaStatus IOManager::beginStartMonitoring ( OpcUa_Handle  hIOManagerContext,
OpcUa_UInt32  callbackHandle,
IOVariableCallback pIOVariableCallback,
VariableHandle pVariableHandle,
MonitoringContext monitoringContext 
)
pure virtual

Begin start monitoring of an item.

Is called by the SDK for each node in a UA CreateMonitoredItems service call if sampling is enabled or for service calls enabling the sampling for a monitored item. It is expected that this method does not block for external communication with the underlying system. See also beginRead description for more details. The corresponding callback method is the finishStartMonitoring method.

Parameters
hIOManagerContextIOManager handle for the transaction context. This handle is used to identify the transaction in the IOManager.
callbackHandleHandle for the node in the callback.
pIOVariableCallbackCallback interface used for data change callbacks to the MonitoredItem managed by the SDK. The callback interface is valid until the monitoring is stopped through beginStopMonitoring.
pVariableHandleVariable handle provided by the NodeManager::getVariableHandle. This object contains the information needed by the IOManager to identify the node to monitor in its context. The object is reference counted. The reference used by the SDK is released after finishTransaction is called. If the IOManager needs the VariableHandle of asynchronous handling, the IOManager must add its own reference as long as the VariableHandle is used.
monitoringContextObject containing the requested settings for the monitored item like sampling interval or deadband. The object is only valid during this method is called
Returns
Error code

Implemented in IOManagerUaNode.

virtual UaStatus IOManager::beginStopMonitoring ( OpcUa_Handle  hIOManagerContext,
OpcUa_UInt32  callbackHandle,
OpcUa_UInt32  hIOVariable 
)
pure virtual

Begin stop monitoring of an item.

Is called by the SDK for each node in a UA DeleteMonitoredItems service call if sampling is enabled for the monitored item to delete or for service calls disabling the sampling for a monitored item. It is expected that this method does not block for external communication with the underlying system. See also beginRead description for more details. The corresponding callback method is the finishStopMonitoring method.

Parameters
hIOManagerContextIOManager handle for the transaction context. This handle is used to identify the transaction in the IOManager.
callbackHandleHandle for the node in the callback.
hIOVariableThe handle of the variable in the IOManager created with beginStartMonitoring. The handle was passed to the SDK in the callback finishStartMonitoring.
Returns
Error code

Implemented in IOManagerUaNode.

virtual UaStatus IOManager::beginTransaction ( IOManagerCallback pCallback,
const ServiceContext serviceContext,
OpcUa_UInt32  hTransaction,
OpcUa_UInt32  totalItemCountHint,
OpcUa_Double  maxAge,
OpcUa_TimestampsToReturn  timestampsToReturn,
TransactionType  transactionType,
OpcUa_Handle &  hIOManagerContext 
)
pure virtual

Begin a IOManager transaction.

Is called by the SDK before the first begin method call for a transaction. This method must create a context in the IOManager for the transaction.

Parameters
pCallbackCallback interface used for the transaction. The IOManager must use this interface to finish the action for each passed node in the transaction. The callback interface pointer is valid until the transaction is completely finished.
serviceContextService context including the session context used for the UA service call.
hTransactionHandle for the transaction used by the SDK to identify the transaction in the callbacks.
totalItemCountHintA hint for the IOManager about the total number of nodes in the transaction. The IOManager may not be responsible for all nodes but he can use this hint if he wants to optimize memory allocation.
maxAgeMax age parameter used only in the Read service.
timestampsToReturnIndicates which timestamps should be returned in a Read or a Publish response. The possible enum values are: OpcUa_TimestampsToReturn_Source OpcUa_TimestampsToReturn_Server OpcUa_TimestampsToReturn_Both OpcUa_TimestampsToReturn_Neither
transactionTypeType of the transaction. The possible enum values are:
  • READ
  • WRITE
  • MONITOR_BEGIN
  • MONITOR_MODIFY
  • MONITOR_STOP
hIOManagerContextHandle to the context in the IOManager for the transaction. The handle is managed by the IOManager and must be valid until the transaction is completely finished. This handle is passed into the IOManager begin methods to identify the transaction context in the IOManager.
Returns
Error code

Implemented in IOManagerUaNode.

virtual UaStatus IOManager::beginWrite ( OpcUa_Handle  hIOManagerContext,
OpcUa_UInt32  callbackHandle,
VariableHandle pVariableHandle,
OpcUa_WriteValue pWriteValue 
)
pure virtual

Begin writing an attribute value for a node.

Is called by the SDK for each node in a UA Write service call. It is expected that this method does not block for external communication with the underlying system. See also beginRead description for more details. The corresponding callback method is the finishWrite method.

OPC UA is not providing data type conversions on the server side. The client is responsible for converting the variable data type to the data type he needs for internally. The server must return OpcUa_BadTypeMismatch if the client is not writing the variable data type or a subtype of it. The only exception is an array of Byte. In this case the client is allowed to write a ByteString instead since environments like JAVA and .NET can not preserve the distinction between a ByteString and a one dimensional array of Byte.

Parameters
hIOManagerContextIOManager handle for the transaction context. This handle is used to identify the transaction in the IOManager.
callbackHandleHandle for the node in the callback. The in parameters are valid until the last finishRead method is called for the transaction.
pVariableHandleVariable handle provided by the NodeManager::getVariableHandle. This object contains the information needed by the IOManager to identify the node to write in its context. The object is reference counted. The reference used by the SDK is released after finishTransaction is called. If the IOManager needs the VariableHandle of asynchronous handling, the IOManager must add its own reference as long as the VariableHandle is used.
pWriteValueContext for the node to write. The context contains the IndexRange requested by the client. The NodeId and Attribute parameters of this context are already handled by the VariableHandle The write context pointer is valid until the transaction is completely finished.
Returns
Error code

Implemented in IOManagerUaNode.

virtual UaStatus IOManager::finishTransaction ( OpcUa_Handle  hIOManagerContext)
pure virtual

Finish a transaction.

Is called by the SDK after the last begin method call for a transaction. If the nodes for the transaction are stored in the transaction context and the access to the underlying system is done in the finishTransaction, this access must be done asynchronous like in an own worker thread. It is expected that this method does not block for external communication with the underlying system. After finishing the communication with the underlying system, the corresponding finish callback methods of the interface IOManagerCallback can be called for each node in the transaction

Parameters
hIOManagerContextIOManager handle for the transaction context. This handle is used to identify the transaction to finish in the IOManager.
Returns
Error code

Implemented in IOManagerUaNode.


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