QOpcUaWriteItem Class

This class stores the options for a write operation. More...

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

Public Functions

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)

Detailed Description

A write operation on an OPC UA server overwrites the entire value or a certain index range of the value of an attribute of a node on the server. This class contains the necessary information for the backend to make a write request to the server.

One or multiple objects of this class make up the request of a QOpcUaClient::writeNodeAttributes() operation.

See also QOpcUaClient::writeNodeAttributes() and QOpcUaWriteResult.

Member Function Documentation

QOpcUaWriteItem::QOpcUaWriteItem()

Default constructs a write item with no parameters set.

QOpcUaWriteItem::QOpcUaWriteItem(const QString &nodeId, QOpcUa::NodeAttribute attribute, const QVariant &value, QOpcUa::Types type = QOpcUa::Types::Undefined, const QString &indexRange = QString())

Creates a write item for the attribute attribute from node nodeId. The value value of type type will be written at position indexRange of attribute.

QOpcUaWriteItem::QOpcUaWriteItem(const QOpcUaWriteItem &other)

Creates a new write item from other.

QOpcUa::NodeAttribute QOpcUaWriteItem::attribute() const

Returns the attribute of the write item.

See also setAttribute().

bool QOpcUaWriteItem::hasStatusCode() const

Returns true if a status code for the value to write has been set.

QString QOpcUaWriteItem::indexRange() const

Returns the index range of the write item.

See also setIndexRange().

QString QOpcUaWriteItem::nodeId() const

Returns the node id of the write item.

See also setNodeId().

QDateTime QOpcUaWriteItem::serverTimestamp() const

Returns the server timestamp for the value to write.

See also setServerTimestamp().

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

Sets the attribute of the write item to attribute.

See also attribute().

void QOpcUaWriteItem::setIndexRange(const QString &indexRange)

Sets the index range of the write item to indexRange.

See also indexRange().

void QOpcUaWriteItem::setNodeId(const QString &nodeId)

Sets the node id of the write item to nodeId.

See also nodeId().

void QOpcUaWriteItem::setServerTimestamp(const QDateTime &serverTimestamp)

Sets the server timestamp for the value to write to serverTimestamp. If the server timestamp is invalid, it is ignored by the client and not sent to the server. If the server doesn't support writing timestamps, the write operation for this item will fail with status code BadWriteNotSupported.

See also serverTimestamp().

void QOpcUaWriteItem::setSourceTimestamp(const QDateTime &sourceTimestamp)

Sets the source timestamp for the value to write to sourceTimestamp. If the source timestamp is invalid, it is ignored by the client and not sent to the server. If the server doesn't support writing timestamps, the write operation for this item will fail with status code BadWriteNotSupported.

See also sourceTimestamp().

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

Sets the status code for the value to write to statusCode. If no status code is set, no status code is sent to the server.

See also statusCode().

void QOpcUaWriteItem::setType(QOpcUa::Types type)

Sets the type of the value of the write item to type.

See also type().

void QOpcUaWriteItem::setValue(const QVariant &value)

Sets the value of the write item to value. If given, the type information from setType() will be used in converting the value to a SDK specific data type.

See also value() and setType().

void QOpcUaWriteItem::setValue(const QVariant &value, QOpcUa::Types type)

Sets the value of the write item to

ConstantDescription
andthe type of the value to type.

QDateTime QOpcUaWriteItem::sourceTimestamp() const

Returns the source timestamp for the value to write.

See also setSourceTimestamp().

QOpcUa::UaStatusCode QOpcUaWriteItem::statusCode() const

Returns the status code for the value to write.

See also setStatusCode().

QOpcUa::Types QOpcUaWriteItem::type() const

Returns the type of the value of the write item.

See also setType().

QVariant QOpcUaWriteItem::value() const

Returns the value of the write item.

See also setValue().

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

Sets the values from rhs in this write item.

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