W3cubDocs

/Qt

QOpcUaMonitoringParameters Class

QOpcUaMonitoringParameters provides a way to set and retrieve parameters for subscriptions and monitored items. More...

Header: #include <QOpcUaMonitoringParameters>
qmake: QT += opcua

Public Types

class DataChangeFilter
class EventFilter
enum class MonitoringMode { Disabled, Sampling, Reporting }
enum class Parameter { PublishingEnabled, PublishingInterval, LifetimeCount, MaxKeepAliveCount, MaxNotificationsPerPublish, …, MonitoringMode }
flags Parameters
enum class SubscriptionType { Shared, Exclusive }

Public Functions

QOpcUaMonitoringParameters(const QOpcUaMonitoringParameters &other)
QOpcUaMonitoringParameters(double publishingInterval, QOpcUaMonitoringParameters::SubscriptionType shared = SubscriptionType::Shared, quint32 subscriptionId = 0)
QOpcUaMonitoringParameters()
QOpcUaMonitoringParameters & operator=(const QOpcUaMonitoringParameters &other)
~QOpcUaMonitoringParameters()
void clearFilter()
void clearFilterResult()
bool discardOldest() const
QVariant filter() const
QVariant filterResult() const
QString indexRange() const
bool isPublishingEnabled() const
quint32 lifetimeCount() const
quint32 maxKeepAliveCount() const
quint32 maxNotificationsPerPublish() const
quint32 monitoredItemId() const
QOpcUaMonitoringParameters::MonitoringMode monitoringMode() const
quint8 priority() const
double publishingInterval() const
quint32 queueSize() const
double samplingInterval() const
void setDiscardOldest(bool discardOldest)
void setFilter(const QOpcUaMonitoringParameters::DataChangeFilter &filter)
void setFilter(const QOpcUaMonitoringParameters::EventFilter &eventFilter)
void setFilterResult(const QOpcUaEventFilterResult &eventFilterResult)
void setIndexRange(const QString &indexRange)
void setLifetimeCount(quint32 lifetimeCount)
void setMaxKeepAliveCount(quint32 maxKeepAliveCount)
void setMaxNotificationsPerPublish(quint32 maxNotificationsPerPublish)
void setMonitoredItemId(quint32 monitoredItemId)
void setMonitoringMode(QOpcUaMonitoringParameters::MonitoringMode monitoringMode)
void setPriority(quint8 priority)
void setPublishingEnabled(bool publishingEnabled)
void setPublishingInterval(double publishingInterval)
void setQueueSize(quint32 queueSize)
void setSamplingInterval(double samplingInterval)
void setStatusCode(QOpcUa::UaStatusCode statusCode)
void setSubscriptionId(quint32 subscriptionId)
void setSubscriptionType(QOpcUaMonitoringParameters::SubscriptionType shared)
QOpcUa::UaStatusCode statusCode() const
quint32 subscriptionId() const
QOpcUaMonitoringParameters::SubscriptionType subscriptionType() const

Detailed Description

This class is used in QOpcUaNode::enableMonitoring() requests and as return value for QOpcUaNode::monitoringStatus() in which case it contains the revised values from the server.

Usage

For most use cases, only the publishing interval is required.

QOpcUaMonitoringParameters p(100); // Set a publishing interval of 100ms and share the subscription.
node->enableMonitoring(QOpcUa::NodeAttribute::Value, p);

If an exclusive subscription is required, use the second parameter.

QOpcUaMonitoringParameters p(100, QOpcUaMonitoringParameters::SubscriptionType::Exclusive); // Create a new subscription

To add additional items to an existing subscription, use the third parameter for the next calls to QOpcUaNode::enableMonitoring().

quint32 subscriptionId = node->monitoringStatus(QOpcUa::NodeAttribute::Value).subscriptionId();
QOpcUaMonitoringParameters p(100, QOpcUaMonitoringParameters::SubscriptionType::Shared, subscriptionId); // Add the monitored item to this subscription

If other parameters are required, they must be set using the setter methods.

Backend support

Not all parameters in this class are supported by all backends.

Parameter Open62541 plugin UACpp plugin
PublishingInterval X X
SamplingInterval X X
LifetimeCount X X
MaxKeepAliveCount X X
Priority X X
IndexRange X X
Shared X X
SubscriptionId X X
PublishingEnabled X X
Filter X X
QueueSize X X
DiscardOldest X X
MonitoringMode X X
IndexRange X X
MaxNotificationsPerPublish X X

Member Type Documentation

enum class QOpcUaMonitoringParameters::MonitoringMode

This enum is used to set the monitoring mode for a monitored item.

Constant Value Description
QOpcUaMonitoringParameters::MonitoringMode::Disabled 0 Sampling is disabled and no notifications are being generated.
QOpcUaMonitoringParameters::MonitoringMode::Sampling 1 Sampling is enabled and notifications are generated and queued, but reporting is disabled.
QOpcUaMonitoringParameters::MonitoringMode::Reporting 2 Sampling is enabled, notifications are generated and queued, reporting is enabled.

enum class QOpcUaMonitoringParameters::Parameterflags QOpcUaMonitoringParameters::Parameters

Enumerates parameters that can be modified at runtime using QOpcUaNode::modifyMonitoring(). Not all values are guaranteed to be supported by all plugins. Lack of support will be reported in the QOpcUaNode::monitoringStatusChanged signal.

Constant Value
QOpcUaMonitoringParameters::Parameter::PublishingEnabled (1 << 0)
QOpcUaMonitoringParameters::Parameter::PublishingInterval (1 << 1)
QOpcUaMonitoringParameters::Parameter::LifetimeCount (1 << 2)
QOpcUaMonitoringParameters::Parameter::MaxKeepAliveCount (1 << 3)
QOpcUaMonitoringParameters::Parameter::MaxNotificationsPerPublish (1 << 4)
QOpcUaMonitoringParameters::Parameter::Priority (1 << 5)
QOpcUaMonitoringParameters::Parameter::SamplingInterval (1 << 6)
QOpcUaMonitoringParameters::Parameter::Filter (1 << 7)
QOpcUaMonitoringParameters::Parameter::QueueSize (1 << 8)
QOpcUaMonitoringParameters::Parameter::DiscardOldest (1 << 9)
QOpcUaMonitoringParameters::Parameter::MonitoringMode (1 << 10)

The Parameters type is a typedef for QFlags<Parameter>. It stores an OR combination of Parameter values.

enum class QOpcUaMonitoringParameters::SubscriptionType

This enum is used to determine if the monitored item can be added to a shared subscription or if a new subscription must be created.

Constant Value Description
QOpcUaMonitoringParameters::SubscriptionType::Shared 0 Share subscription with other monitored items with the same interval
QOpcUaMonitoringParameters::SubscriptionType::Exclusive 1 Request a new subscription for this attribute

Member Function Documentation

QOpcUaMonitoringParameters::QOpcUaMonitoringParameters(const QOpcUaMonitoringParameters &other)

Constructs a QOpcuaMonitoringParameters object from the value of other.

QOpcUaMonitoringParameters::QOpcUaMonitoringParameters(double publishingInterval, QOpcUaMonitoringParameters::SubscriptionType shared = SubscriptionType::Shared, quint32 subscriptionId = 0)

This is the constructor which covers most use cases for the Qt OPC UA user. publishingInterval must be supplied, shared and subscriptionId are optional.

QOpcUaMonitoringParameters::QOpcUaMonitoringParameters()

The default constructor for QOpcUaMonitoringParameters.

QOpcUaMonitoringParameters &QOpcUaMonitoringParameters::operator=(const QOpcUaMonitoringParameters &other)

Assigns the value of other to this object.

QOpcUaMonitoringParameters::~QOpcUaMonitoringParameters()

The destructor for QOpcUaMonitoringParameters.

void QOpcUaMonitoringParameters::clearFilter()

Removes the current filter from the monitoring parameters.

See also filter() and setFilter().

void QOpcUaMonitoringParameters::clearFilterResult()

Removes the current filter result from the monitoring parameters.

See also filterResult() and setFilterResult().

bool QOpcUaMonitoringParameters::discardOldest() const

Returns the discardOldest setting of the monitored item.

See also setDiscardOldest().

QVariant QOpcUaMonitoringParameters::filter() const

Returns the current filter.

See also setFilter().

QVariant QOpcUaMonitoringParameters::filterResult() const

Returns the filter result.

This value is empty for an attribute monitoring. In case of an event monitoring, the filter result can be empty if the server did not detect any errors in the filter.

See also setFilterResult().

QString QOpcUaMonitoringParameters::indexRange() const

Returns the index range for the monitored item.

See also setIndexRange().

bool QOpcUaMonitoringParameters::isPublishingEnabled() const

Returns the publishing mode for the subscription.

quint32 QOpcUaMonitoringParameters::lifetimeCount() const

Returns the lifetime count of the subscription.

See also setLifetimeCount().

quint32 QOpcUaMonitoringParameters::maxKeepAliveCount() const

Returns the maximum keepalive count of the subscription.

See also setMaxKeepAliveCount().

quint32 QOpcUaMonitoringParameters::maxNotificationsPerPublish() const

Returns the maximum notifications per publish value of the subscription.

See also setMaxNotificationsPerPublish().

quint32 QOpcUaMonitoringParameters::monitoredItemId() const

Returns the monitored item id assigned by the server. If the monitored item id is 0, the monitored item could not be successfully created.

See also setMonitoredItemId().

QOpcUaMonitoringParameters::MonitoringMode QOpcUaMonitoringParameters::monitoringMode() const

Returns the monitoring mode for the monitored item.

See also setMonitoringMode().

quint8 QOpcUaMonitoringParameters::priority() const

Returns the priority of the subscription used for the monitored item.

See also setPriority().

double QOpcUaMonitoringParameters::publishingInterval() const

Returns the publishing interval of the subscription. The interval is expressed in milliseconds.

See also setPublishingInterval().

quint32 QOpcUaMonitoringParameters::queueSize() const

Returns the queue size of the monitored item.

See also setQueueSize().

double QOpcUaMonitoringParameters::samplingInterval() const

Returns the revised sampling interval of the monitored item. The interval is expressed in milliseconds.

See also setSamplingInterval().

void QOpcUaMonitoringParameters::setDiscardOldest(bool discardOldest)

Set discardOldest as discardOldest setting for the monitored item.

See also discardOldest().

void QOpcUaMonitoringParameters::setFilter(const QOpcUaMonitoringParameters::DataChangeFilter &filter)

Sets DataChangeFilter filter as filter for the monitored item. If another data change filter or an event filter is present, it will be replaced.

If the server does not accept the filter, this will be indicated by the status code after the QOpcUaNode::enableMonitoring() request has finished.

See also filter().

void QOpcUaMonitoringParameters::setFilter(const QOpcUaMonitoringParameters::EventFilter &eventFilter)

Request eventFilter as filter for the monitored item. If another event filter or a data change filter is present, it will be replaced. If the server does not accept the filter, this will be indicated by the status code and the event filter result after the QOpcUaNode::enableMonitoring() request has finished.

See also filter().

void QOpcUaMonitoringParameters::setFilterResult(const QOpcUaEventFilterResult &eventFilterResult)

Sets the event filter result to eventFilterResult.

This method must only be used by the backend, setting an event filter result as a user does not have any effect.

See also filterResult().

void QOpcUaMonitoringParameters::setIndexRange(const QString &indexRange)

Requests indexRange as index range for the monitored item. For details on the index range string, see QOpcUaNode::readAttributeRange().

See also indexRange().

void QOpcUaMonitoringParameters::setLifetimeCount(quint32 lifetimeCount)

Request lifetimeCount as lifetime count for the subscription.

See also lifetimeCount().

void QOpcUaMonitoringParameters::setMaxKeepAliveCount(quint32 maxKeepAliveCount)

Request maxKeepAliveCount as maximum keepalive count for the subscription.

See also maxKeepAliveCount().

void QOpcUaMonitoringParameters::setMaxNotificationsPerPublish(quint32 maxNotificationsPerPublish)

Set maxNotificationsPerPublish as maximum notifications per publish value for the subscription.

See also maxNotificationsPerPublish().

void QOpcUaMonitoringParameters::setMonitoredItemId(quint32 monitoredItemId)

Sets the monitored item id to monitoredItemId.

Setting this value as a client has no effect.

See also monitoredItemId().

void QOpcUaMonitoringParameters::setMonitoringMode(QOpcUaMonitoringParameters::MonitoringMode monitoringMode)

Set monitoringMode as monitoring mode for the monitored item.

See also monitoringMode().

void QOpcUaMonitoringParameters::setPriority(quint8 priority)

Set priority as priority for the subscription.

See also priority().

void QOpcUaMonitoringParameters::setPublishingEnabled(bool publishingEnabled)

Set publishingEnabled as publishing mode for the subscription.

See also isPublishingEnabled().

void QOpcUaMonitoringParameters::setPublishingInterval(double publishingInterval)

Request publishingInterval as publishing interval for the subscription. The interval is expressed in milliseconds.

See also publishingInterval().

void QOpcUaMonitoringParameters::setQueueSize(quint32 queueSize)

Request queueSize as queue size for the monitored item.

See also queueSize().

void QOpcUaMonitoringParameters::setSamplingInterval(double samplingInterval)

Request samplingInterval as sampling interval for the monitored item. The interval is expressed in milliseconds.

See also samplingInterval().

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

Set the status code to statusCode.

See also statusCode().

void QOpcUaMonitoringParameters::setSubscriptionId(quint32 subscriptionId)

Request the monitored items to be created on a known subscription with subscriptionId.

See also subscriptionId().

void QOpcUaMonitoringParameters::setSubscriptionType(QOpcUaMonitoringParameters::SubscriptionType shared)

Request shared as subscription type for the subscription.

See also subscriptionType().

QOpcUa::UaStatusCode QOpcUaMonitoringParameters::statusCode() const

Returns the status code of the monitored item creation.

See also setStatusCode().

quint32 QOpcUaMonitoringParameters::subscriptionId() const

Returns the assigned subscription id.

See also setSubscriptionId().

QOpcUaMonitoringParameters::SubscriptionType QOpcUaMonitoringParameters::subscriptionType() const

Returns the subscription type.

See also setSubscriptionType().

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qopcuamonitoringparameters.html