QOpcUaReadResult Class

This class stores the result of a read operation. More...

Header: #include <QOpcUaReadResult>
CMake: find_package(Qt6 REQUIRED COMPONENTS OpcUa)
target_link_libraries(mytarget PRIVATE Qt6::OpcUa)
qmake: QT += opcua

Public Functions

QOpcUaReadResult()
QOpcUaReadResult(const QOpcUaReadResult &other)
QOpcUa::NodeAttribute attribute() const
QString indexRange() const
QString nodeId() const
QDateTime serverTimestamp() const
void setAttribute(QOpcUa::NodeAttribute attribute)
void setIndexRange(const QString &indexRange)
void setNodeId(const QString &nodeId)
void setServerTimestamp(const QDateTime &serverTimestamp)
void setSourceTimestamp(const QDateTime &sourceTimestamp)
void setStatusCode(QOpcUa::UaStatusCode statusCode)
void setValue(const QVariant &value)
QDateTime sourceTimestamp() const
QOpcUa::UaStatusCode statusCode() const
QVariant value() const
QOpcUaReadResult &operator=(const QOpcUaReadResult &rhs)

Detailed Description

A read operation on an OPC UA server returns the value and timestamps which describe when a value was generated by the source and when the server obtained it. It also returns a status code which describes if the value could be read and if not, for what reason the read has failed.

In addition to the data returned by the server, this class also contains the node id, the attribute and the index range from the request to enable a client to match the result with a request.

Objects of this class are returned in the QOpcUaClient::readNodeAttributesFinished() signal and contain the result of a read operation that was part of a QOpcUaClient::readNodeAttributes() request.

See also QOpcUaClient::readNodeAttributes(), QOpcUaClient::readNodeAttributesFinished(), and QOpcUaReadItem.

Member Function Documentation

QOpcUaReadResult::QOpcUaReadResult()

Default constructs a read result with no parameters set.

QOpcUaReadResult::QOpcUaReadResult(const QOpcUaReadResult &other)

Constructs a read result from other.

QOpcUa::NodeAttribute QOpcUaReadResult::attribute() const

Returns the attribute id.

See also setAttribute().

QString QOpcUaReadResult::indexRange() const

Returns the index range.

See also setIndexRange().

QString QOpcUaReadResult::nodeId() const

Returns the node id.

See also setNodeId().

QDateTime QOpcUaReadResult::serverTimestamp() const

Returns the server timestamp for value().

See also setServerTimestamp().

void QOpcUaReadResult::setAttribute(QOpcUa::NodeAttribute attribute)

Sets the attribute id to attribute.

See also attribute().

void QOpcUaReadResult::setIndexRange(const QString &indexRange)

Sets the index range to indexRange.

See also indexRange().

void QOpcUaReadResult::setNodeId(const QString &nodeId)

Sets the node id to nodeId.

See also nodeId().

void QOpcUaReadResult::setServerTimestamp(const QDateTime &serverTimestamp)

Sets the server timestamp to serverTimestamp.

See also serverTimestamp().

void QOpcUaReadResult::setSourceTimestamp(const QDateTime &sourceTimestamp)

Sets the source timestamp to sourceTimestamp.

See also sourceTimestamp().

void QOpcUaReadResult::setStatusCode(QOpcUa::UaStatusCode statusCode)

Sets the status code to statusCode.

See also statusCode().

void QOpcUaReadResult::setValue(const QVariant &value)

Sets the value to value.

See also value().

QDateTime QOpcUaReadResult::sourceTimestamp() const

Returns the source timestamp for value().

See also setSourceTimestamp().

QOpcUa::UaStatusCode QOpcUaReadResult::statusCode() const

Returns the status code for this element. If the status code is not Good, the value and the timestamps are invalid.

See also setStatusCode().

QVariant QOpcUaReadResult::value() const

Returns the value.

See also setValue().

QOpcUaReadResult &QOpcUaReadResult::operator=(const QOpcUaReadResult &rhs)

Sets the values from rhs in this read result.