open62541pp 0.17.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
opcua::ValueCallbackBase Class Referenceabstract

#include <nodestore.hpp>

Inheritance diagram for opcua::ValueCallbackBase:
[legend]

Detailed Description

Value callback base class for variable nodes.

Value callbacks allow to synchronize a variable value with an external representation. The attached callbacks are executed before every read and after every write operation.

See also
https://www.open62541.org/doc/1.3/tutorial_server_datasource.html
Examples
server_valuecallback.cpp.

Definition at line 18 of file nodestore.hpp.

Public Member Functions

virtual void onRead (Session &session, const NodeId &id, const NumericRange *range, const DataValue &value)=0
 
virtual void onWrite (Session &session, const NodeId &id, const NumericRange *range, const DataValue &value)=0
 
UA_ValueCallback create (bool ownsAdapter) override
 
- Public Member Functions inherited from opcua::PluginAdapter< UA_ValueCallback >
 PluginAdapter ()=default
 
 PluginAdapter (const PluginAdapter &)=default
 
 PluginAdapter (PluginAdapter &&) noexcept=default
 
virtual ~PluginAdapter ()=default
 
PluginAdapteroperator= (const PluginAdapter &)=default
 
PluginAdapteroperator= (PluginAdapter &&) noexcept=default
 

Additional Inherited Members

- Public Types inherited from opcua::PluginAdapter< UA_ValueCallback >
using PluginType
 

Member Function Documentation

◆ onRead()

virtual void opcua::ValueCallbackBase::onRead ( Session & session,
const NodeId & id,
const NumericRange * range,
const DataValue & value )
pure virtual

Called before the value attribute is read.

It is possible to write into the value attribute during onBeforeRead (using e.g. services::writeValue or Node::writeValue). The node is re-opened afterwards so that changes are considered in the following read operation.

Parameters
sessionCurrent session
idThe identifier of the node being read from
rangeOptional numeric range the client wants to read from
valueCurrent value before the read operation
Examples
server_valuecallback.cpp.

◆ onWrite()

virtual void opcua::ValueCallbackBase::onWrite ( Session & session,
const NodeId & id,
const NumericRange * range,
const DataValue & value )
pure virtual

Called after writing the value attribute.

The node is re-opened after writing so that the new value is visible in the callback.

Parameters
sessionCurrent session
idThe identifier of the node being written to
rangeOptional numeric range the client wants to write to
valueNew value after the write operation
Examples
server_valuecallback.cpp.

◆ create()

UA_ValueCallback opcua::ValueCallbackBase::create ( bool ownsAdapter)
overridevirtual