QOpcUaWriteItem Class
该类用于存储写入操作的相关选项。更多内容...
| 头文件: | #include <QOpcUaWriteItem> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS OpcUa) target_link_libraries(mytarget PRIVATE Qt6::OpcUa) |
| qmake: | QT += opcua |
公共函数
| QOpcUaWriteItem() | |
| QOpcUaWriteItem(const QString &nodeId, QOpcUa::NodeAttribute attribute, const QVariant &value, QOpcUa::Types type = QOpcUa::Types::Undefined, const QString &indexRange = QString()) | |
| QOpcUaWriteItem(const QOpcUaWriteItem &other) | |
| QOpcUa::NodeAttribute | attribute() const |
| bool | hasStatusCode() 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 | setType(QOpcUa::Types type) |
| void | setValue(const QVariant &value) |
| void | setValue(const QVariant &value, QOpcUa::Types type) |
| QDateTime | sourceTimestamp() const |
| QOpcUa::UaStatusCode | statusCode() const |
| QOpcUa::Types | type() const |
| QVariant | value() const |
| QOpcUaWriteItem & | operator=(const QOpcUaWriteItem &rhs) |
详细说明
在 OPC UA 服务器上进行的写入操作将覆盖服务器上某个节点的属性值的全部内容或特定索引范围内的内容。本类包含后端向服务器发出写入请求所需的必要信息。
一个或多个该类的对象共同构成QOpcUaClient::writeNodeAttributes()操作的请求。
另请参阅 QOpcUaClient::writeNodeAttributes() 和QOpcUaWriteResult 。
成员函数文档
QOpcUaWriteItem::QOpcUaWriteItem()
默认情况下会构建一个未设置任何参数的写入项。
QOpcUaWriteItem::QOpcUaWriteItem(const QString &nodeId, QOpcUa::NodeAttribute attribute, const QVariant &value, QOpcUa::Types type = QOpcUa::Types::Undefined, const QString &indexRange = QString())
为节点nodeId 的属性attribute 创建一个写入项。类型为type 的值value 将写入attribute 的位置indexRange 。
QOpcUaWriteItem::QOpcUaWriteItem(const QOpcUaWriteItem &other)
从other 创建一个新的写入项。
QOpcUa::NodeAttribute QOpcUaWriteItem::attribute() const
返回写入项的属性。
另请参阅 setAttribute()。
bool QOpcUaWriteItem::hasStatusCode() const
如果要写入的值已设置状态码,则返回 true。
QString QOpcUaWriteItem::indexRange() const
返回写入项的索引范围。
另请参阅 setIndexRange()。
QString QOpcUaWriteItem::nodeId() const
返回写入项的节点 ID。
另请参阅 setNodeId()。
QDateTime QOpcUaWriteItem::serverTimestamp() const
返回待写入值的服务器时间戳。
另请参阅 setServerTimestamp()。
void QOpcUaWriteItem::setAttribute(QOpcUa::NodeAttribute attribute)
将写入项的属性设置为attribute 。
另请参阅 attribute()。
void QOpcUaWriteItem::setIndexRange(const QString &indexRange)
将写入项的索引范围设置为indexRange 。
另请参阅 indexRange()。
void QOpcUaWriteItem::setNodeId(const QString &nodeId)
将写入项的节点 ID 设置为nodeId 。
另请参阅 nodeId()。
void QOpcUaWriteItem::setServerTimestamp(const QDateTime &serverTimestamp)
设置要写入serverTimestamp 的值的服务器时间戳。如果服务器时间戳无效,客户端将忽略该时间戳且不会将其发送给服务器。如果服务器不支持写入时间戳,则该项的写入操作将失败,并返回状态码BadWriteNotSupported 。
另请参阅 serverTimestamp()。
void QOpcUaWriteItem::setSourceTimestamp(const QDateTime &sourceTimestamp)
设置要写入sourceTimestamp 的值的源时间戳。如果源时间戳无效,客户端将忽略该时间戳,且不会将其发送给服务器。如果服务器不支持写入时间戳,则该项的写入操作将失败,并返回状态码BadWriteNotSupported 。
另请参阅 sourceTimestamp()。
void QOpcUaWriteItem::setStatusCode(QOpcUa::UaStatusCode statusCode)
设置要写入statusCode 的值的状态码。如果未设置状态码,则不会向服务器发送任何状态码。
另请参阅 statusCode()。
void QOpcUaWriteItem::setType(QOpcUa::Types type)
将写入项的值类型设置为type 。
另请参阅 type()。
void QOpcUaWriteItem::setValue(const QVariant &value)
将写入项的值设置为value 。如果提供了该参数,则在将该值转换为 SDK 特定数据类型时,将使用setType() 返回的类型信息。
void QOpcUaWriteItem::setValue(const QVariant &value, QOpcUa::Types type)
将写入项的值设置为
| 常量 | 描述 |
|---|---|
and | 将值的类型设置为type 。 |
QDateTime QOpcUaWriteItem::sourceTimestamp() const
返回待写入值的源时间戳。
另请参阅 setSourceTimestamp()。
QOpcUa::UaStatusCode QOpcUaWriteItem::statusCode() const
返回待写入值的状态码。
另请参阅 setStatusCode()。
QOpcUa::Types QOpcUaWriteItem::type() const
返回写入项的值的类型。
另请参阅 setType()。
QVariant QOpcUaWriteItem::value() const
返回写入项的值。
另请参阅 setValue()。
QOpcUaWriteItem &QOpcUaWriteItem::operator=(const QOpcUaWriteItem &rhs)
将rhs 中的值设置到此写入项中。
© 2026 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.