open62541pp 0.16.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
opcua::ValueCallback Struct Reference

#include <nodestore.hpp>

Detailed Description

Value callbacks 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 16 of file nodestore.hpp.

Public Attributes

std::function< void(const DataValue &value)> onBeforeRead
 
std::function< void(const DataValue &value)> onAfterWrite
 

Member Data Documentation

◆ onBeforeRead

std::function<void(const DataValue& value)> opcua::ValueCallback::onBeforeRead

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
valueCurrent value before the read operation
Examples
server_valuecallback.cpp.

Definition at line 26 of file nodestore.hpp.

◆ onAfterWrite

std::function<void(const DataValue& value)> opcua::ValueCallback::onAfterWrite

Called after writing the value attribute.

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

Parameters
valueNew value after the write operation

Definition at line 35 of file nodestore.hpp.