QOpcUaReadResult Class

该类存储读取操作的结果。更多

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

公共函数

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)

详细说明

OPC UA 服务器上的读取操作会返回值和时间戳,时间戳描述了源生成值的时间和服务器获取值的时间。它还会返回一个状态代码,说明是否能读取该值,如果不能,读取失败的原因是什么。

除了服务器返回的数据外,该类还包含节点 ID、属性和请求中的索引范围,以便客户端将结果与请求进行匹配。

该类对象在QOpcUaClient::readNodeAttributesFinished() 信号中返回,并包含作为QOpcUaClient::readNodeAttributes() 请求一部分的读取操作的结果。

另请参阅 QOpcUaClient::readNodeAttributes()、QOpcUaClient::readNodeAttributesFinished() 和QOpcUaReadItem

成员函数文档

QOpcUaReadResult::QOpcUaReadResult()

默认情况下构建一个未设置参数的读取结果。

QOpcUaReadResult::QOpcUaReadResult(const QOpcUaReadResult &other)

other 构建读取结果。

QOpcUa::NodeAttribute QOpcUaReadResult::attribute() const

返回属性 id。

另请参阅 setAttribute()。

QString QOpcUaReadResult::indexRange() const

返回索引范围。

另请参见 setIndexRange()。

QString QOpcUaReadResult::nodeId() const

返回节点 ID。

另请参见 setNodeId()。

QDateTime QOpcUaReadResult::serverTimestamp() const

返回value() 的服务器时间戳。

另请参阅 setServerTimestamp().

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

将属性 id 设为attribute

另请参阅 attribute() 。

void QOpcUaReadResult::setIndexRange(const QString &indexRange)

将索引范围设置为indexRange

另请参阅 indexRange() 。

void QOpcUaReadResult::setNodeId(const QString &nodeId)

将节点 id 设为nodeId

另请参阅 nodeId() 。

void QOpcUaReadResult::setServerTimestamp(const QDateTime &serverTimestamp)

将服务器时间戳设置为serverTimestamp

另请参阅 serverTimestamp() 。

void QOpcUaReadResult::setSourceTimestamp(const QDateTime &sourceTimestamp)

将源时间戳设置为sourceTimestamp

另请参阅 sourceTimestamp() 。

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

将状态代码设为statusCode

另请参阅 statusCode() 。

void QOpcUaReadResult::setValue(const QVariant &value)

将值设置为value

另请参阅 value() 。

QDateTime QOpcUaReadResult::sourceTimestamp() const

返回value() 的源时间戳。

另请参阅 setSourceTimestamp().

QOpcUa::UaStatusCode QOpcUaReadResult::statusCode() const

返回该元素的状态代码。如果状态代码不是Good ,则值和时间戳无效。

另请参见 setStatusCode()。

QVariant QOpcUaReadResult::value() const

返回值。

另请参见 setValue()。

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

设置读取结果中rhs 的值。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.