QOpcUaMonitoringParameters provides a way to set and retrieve parameters for subscriptions and monitored items. More...
Header: | #include <QOpcUaMonitoringParameters> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS OpcUa) target_link_libraries(mytarget PRIVATE Qt6::OpcUa) |
qmake: | QT += opcua |
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 } |
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 |
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.
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.
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 |
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. |
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.
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 |
Constructs a QOpcuaMonitoringParameters object from the value of other.
This is the constructor which covers most use cases for the Qt OPC UA user. publishingInterval must be supplied, shared and subscriptionId are optional.
The default constructor for QOpcUaMonitoringParameters.
Assigns the value of other to this object.
The destructor for QOpcUaMonitoringParameters.
Removes the current filter from the monitoring parameters.
See also filter() and setFilter().
Removes the current filter result from the monitoring parameters.
See also filterResult() and setFilterResult().
Returns the discardOldest setting of the monitored item.
See also setDiscardOldest().
Returns the current filter.
See also setFilter().
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().
Returns the index range for the monitored item.
See also setIndexRange().
Returns the publishing mode for the subscription.
Returns the lifetime count of the subscription.
See also setLifetimeCount().
Returns the maximum keepalive count of the subscription.
See also setMaxKeepAliveCount().
Returns the maximum notifications per publish value of the subscription.
See also setMaxNotificationsPerPublish().
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().
Returns the monitoring mode for the monitored item.
See also setMonitoringMode().
Returns the priority of the subscription used for the monitored item.
See also setPriority().
Returns the publishing interval of the subscription. The interval is expressed in milliseconds.
See also setPublishingInterval().
Returns the queue size of the monitored item.
See also setQueueSize().
Returns the revised sampling interval of the monitored item. The interval is expressed in milliseconds.
See also setSamplingInterval().
Set discardOldest as discardOldest setting for the monitored item.
See also discardOldest().
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().
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().
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().
Requests indexRange as index range for the monitored item. For details on the index range string, see QOpcUaNode::readAttributeRange().
See also indexRange().
Request lifetimeCount as lifetime count for the subscription.
See also lifetimeCount().
Request maxKeepAliveCount as maximum keepalive count for the subscription.
See also maxKeepAliveCount().
Set maxNotificationsPerPublish as maximum notifications per publish value for the subscription.
See also maxNotificationsPerPublish().
Sets the monitored item id to monitoredItemId.
Setting this value as a client has no effect.
See also monitoredItemId().
Set monitoringMode as monitoring mode for the monitored item.
See also monitoringMode().
Set priority as priority for the subscription.
See also priority().
Set publishingEnabled as publishing mode for the subscription.
See also isPublishingEnabled().
Request publishingInterval as publishing interval for the subscription. The interval is expressed in milliseconds.
See also publishingInterval().
Request queueSize as queue size for the monitored item.
See also queueSize().
Request samplingInterval as sampling interval for the monitored item. The interval is expressed in milliseconds.
See also samplingInterval().
Set the status code to statusCode.
See also statusCode().
Request the monitored items to be created on a known subscription with subscriptionId.
See also subscriptionId().
Request shared as subscription type for the subscription.
See also subscriptionType().
Returns the status code of the monitored item creation.
See also setStatusCode().
Returns the assigned subscription id.
See also setSubscriptionId().
Returns the subscription type.
See also setSubscriptionType().