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::NodeAttributeattribute, const QVariant&value, QOpcUa::Typestype= QOpcUa::Types::Undefined, const QString&indexRange= QString())
QOpcUaWriteItem(常量 QOpcUaWriteItem&other)
QOpcUa::节点属性 attribute()常量
bool hasStatusCode()常量
QString indexRange()常量
QString nodeId()常量
QDateTime serverTimestamp()常数
void setAttribute(QOpcUa::NodeAttribute属性)
无效 setIndexRange(const QString&indexRange)
无效 setNodeId(const QString&nodeId)
无效 setServerTimestamp(const QDateTime&serverTimestamp)
void setSourceTimestamp(const QDateTime&sourceTimestamp)
void setStatusCode(QOpcUa::UaStatusCodestatusCode)
void setType(QOpcUa::Typestype)
void setValue(const QVariant&value)
void setValue(常量 QVariant&value, QOpcUa::Typestype)
日期时间 sourceTimestamp()常量
QOpcUa::UaStatusCode statusCode()常量
QOpcUa::Types type() 常量
QVariant value()常量
QOpcUaWriteItem &rhsoperator=(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 。如果给定,将使用setType() 中的类型信息将值转换为 SDK 特定的数据类型。

另请参阅 value() 和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 中的值。

© 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.